Skip to content

Instantly share code, notes, and snippets.

@AdmiralPotato
Last active April 3, 2022 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdmiralPotato/611f53a1ad86d921c1cbb9e59330ec59 to your computer and use it in GitHub Desktop.
Save AdmiralPotato/611f53a1ad86d921c1cbb9e59330ec59 to your computer and use it in GitHub Desktop.
Just a little sqlite in node
.idea
*.iml
.data
node_modules
const sqlite3 = require('@vscode/sqlite3');
const sqlite = require('sqlite');
sqlite.open({
filename: './.data/db.sqlite',
driver: sqlite3.Database
})
.then((db) => {
db.all('SELECT * FROM goat WHERE is_grumpy = 1')
.then((result) => {
console.log(result);
})
.catch((error) => {
console.error(error);
})
});
{
"name": "play_with_sqlite",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@vscode/sqlite3": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/@vscode/sqlite3/-/sqlite3-5.0.8.tgz",
"integrity": "sha512-6wvQdMjpi1kwYI5mfzm98siEQb2mlBKX4xdNtJFj/uNqb6wqd3JOhk+5FL7geR0hduXE5lHjv+q69jtsEtUJDA==",
"requires": {
"node-addon-api": "^4.2.0"
}
},
"node-addon-api": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz",
"integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ=="
},
"sqlite": {
"version": "4.0.25",
"resolved": "https://registry.npmjs.org/sqlite/-/sqlite-4.0.25.tgz",
"integrity": "sha512-gqCEcLF8FOTeW/na3SRYWLQkw2jZXgVj1DdgRJbm0jvrhnUgBIuNDUUm649AnBNDNHhI5XskwT8dvc8vearRLQ=="
}
}
}
{
"name": "play_with_sqlite",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"@vscode/sqlite3": "^5.0.8",
"sqlite": "^4.0.25"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment