blinkdb
blinkdb copied to clipboard
where filter does not work on BOOLEAN property that is indexed
Bug only on indexed boolean property. Works find is 'done' prop is converted to number using 0 or 1
const db = createDB()
type Todo = { id: number; text: string; done: boolean }
const todos = createTable<Todo>(db, 'todos')({ primary: 'id', indexes: ['done'] })
await insert(todos, { id: 1, text: 'Buy milk', done: false })
await insert(todos, { id: 2, text: 'Buy bread', done: true })
const all = await many(todos, { where: { done: false } })
//All is empty if indexes is 'done'
//Works if does not have indexes