This document here explains that using onConflict()
and ignore()
will simply drop the action quietly. If I am trying to insert a new row into a table as following:
const addItem = (item) => {
return database(dbTable).insert(item)
.onConflict('name')
.ignore()
.then(() => {
}).catch((err) => {
console.log(err)
})
}
If instead of ignoring
, how (or where) do I return some sort of signal to the external call that invokes the function addItem
? For example, return 0
if no conflict (and item being added); return 1
if there is conflict (and the promise quietly resolved without doing anything)? Thanks