Get memos in bulk

This commit is contained in:
Natsumi
2022-05-18 11:29:11 +12:00
parent dd06090682
commit f710f1f55b
2 changed files with 39 additions and 6 deletions

View File

@@ -158,6 +158,21 @@ class Database {
return row;
}
async getAllMemos() {
var memos = [];
await sqliteService.execute(
(dbRow) => {
var row = {
userId: dbRow[0],
memo: dbRow[1]
};
memos.push(row);
},
'SELECT user_id, memo FROM memos'
);
return memos;
}
setMemo(entry) {
sqliteService.executeNonQuery(
`INSERT OR REPLACE INTO memos (user_id, edited_at, memo) VALUES (@user_id, @edited_at, @memo)`,