You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HerrHase
a9eea03134
|
4 months ago | |
---|---|---|
resources | 5 months ago | |
src | 4 months ago | |
test | 4 months ago | |
.gitignore | 5 months ago | |
LICENSE | 5 months ago | |
README.md | 4 months ago | |
bunfig.toml | 4 months ago | |
index.ts | 5 months ago | |
package.json | 5 months ago |
README.md
Nano Sqlite
Functions and Classes for handle sqlite in Bun.
API
getOrCreateSqlite(options = {})
Options are using default Parameters from Bun. There path can be set by .env
NANO_SQLITE_PATH="./../storage/db.sqlite"
or by parameter,
const db = getOrCreateSqlite({ path: './../storage/db.sqlite' })
Per Default WAL mode is enabled. To disable add parameter "wal",
const db = getOrCreateSqlite({ path: './../storage/db.sqlite', 'wal': false })
runMigrationSqlite(filePath: string, db: object)
Reads SQL-Files from a Directory and execute them in the Sqlite.
Store
Store is a Abstract Class to extend a Class for an Single Table. There are no functions to validating Columns.
class <store-name>Store extends Store {
constructor(db) {
super(db, '<table-name>')
}
}
findOneById(id: integer)
Getting single row by Id.
create(data: object)
Create a new row in a Table.
update(id: integer, data: object)
Update single row by Id.
remove(id: integer)
Remove single row by Id.