ltsharma / expo-sqlite-query-helper

SQLite query helper library for expo-sqlite
MIT License
9 stars 5 forks source link

How to delete multiple rows #8

Open codthing opened 3 years ago

codthing commented 3 years ago

I want to delete id:1 and id:2 at the same time, instead of one by one.

Something like this:

const del_data = [{"id":1, "name":"tom"},{"id":2,"name":"kelly"}]

// table data : 
// [{"id":1, "name":"tom"},{"id":2,"name":"kelly"},{"id":3, "name":"siro"}]

del_data.map((item) => {
   deleteData('searchTable', { id: item.id })
})
ltsharma commented 3 years ago

You code seems Ok, only it needs to be handled with async await if you are performing read just after delete. As in example Delete Data