How to conditionally update? #1941
Unanswered
greenking19
asked this question in
Q&A
Replies: 1 comment
-
In SQL, you can use something called an upsert for this. I recommend reading the article from sqlite's documentation, it gives a good introduction of the SQL behind this and is helpful to understand. I assume that your await db.into(db.testTable).insert(
yourFetchedRow,
onConflict: DoUpdate(
(old) => yourFetchedRow,
where: (old) => old.updateStatus.equalsValue('1')
),
); This essentially means that
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some data to be fetched from the server, compare it against the local data, and then judge whether to insert or update.
table cloumn name 👇
get server list data
Beta Was this translation helpful? Give feedback.
All reactions