import { verbose } from 'sqlite3';
import { isLeft } from 'fputils';
import { getDatabase, all } from 'sqlite-maybe';
const database = await getDatabase(verbose(), 'users.db');
if (isLeft(database)) {
return `Cannot connect to database: ${database.value.message}`;
}
const users = await all<IUser[]>(database.value, 'SELECT * FROM users');
if (isLeft(users)) {
return `Got some database error: ${users.value.message}`;
}
console.log(users.value); // [...]
flsy/sqlite-maybe
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Packages 0
No packages published