Skip to content

Commit

Permalink
SQLite backend: Add updateMetadata method
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Sep 5, 2022
1 parent 93f6caf commit db13a8e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/backend/sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,12 @@ CREATE TABLE metadata (

return { ...metadata, recCount, occCount, vocCount }
}

async updateMetadata(data) {
if (!Array.isArray(data)) {
data = [data]
}
const update = this.db.prepare("INSERT INTO metadata VALUES (@key, @value) ON CONFLICT (key) DO UPDATE SET value = @value")
data.forEach(row => update.run(row))
}
}

0 comments on commit db13a8e

Please sign in to comment.