Use these methods on any table. You’d select a table using db.from(*insert table name*), and chain it with any of the following methods:

  • getAll()
  • get(id)
  • add(value)
  • update(id, value)
  • replace(id, value)
  • delete(id)
Make sure not to create any id or created_at field since these are reserved and exist with every row. You can access them with the get operators

Get all records

const allNotes = await db.from('notes').getAll();

Get by ID

const note = await db.from('notes').get('note-id-here');
  • Method: get(id)
  • Returns: Record object or throws if not found

Add a record

const newNote = await db.from('notes').add({...});
  • Method: add(value)
  • Returns: The newly added record

Update a record

const updated = await db.from('notes').update('noteId', { completed: true })
  • Method: update(id, value)

Replace a record

const replaced = await db.from('notes').replace('noteId', {...})
  • Method: replace(id, value)

Delete a record

const deleted = await db.from('notes').delete('noteId')
  • Method: delete(id)