Skip to content

Instantly share code, notes, and snippets.

@motorro
Created March 12, 2020 11:23
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 motorro/8b77ddfcfa0f49d38f391fe6ff1c816a to your computer and use it in GitHub Desktop.
Save motorro/8b77ddfcfa0f49d38f391fe6ff1c816a to your computer and use it in GitHub Desktop.
Calling template
async function createDb(): Promise<void> {
const db: Database = new Database("db.db");
await populate("app/scr/schemas/1.json", db, function(this: Database): Promise<void> {
return new Promise<void>(function(resolve, reject) {
this.exec("INSERT INTO `playlists` (id, title, genre) VALUES (1, 'SAMPLE', 'JAZZ')", (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
});
db.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment