Skip to content

Instantly share code, notes, and snippets.

@arantesxyz
Last active February 19, 2021 23:59
Show Gist options
  • Select an option

  • Save arantesxyz/7fc3507e1a40210dca78d1e37d8128d9 to your computer and use it in GitHub Desktop.

Select an option

Save arantesxyz/7fc3507e1a40210dca78d1e37d8128d9 to your computer and use it in GitHub Desktop.
Example of working with sqlite3 and async/await
const sql = require("sqlite");
async function create(data) {
if (!data) throw new Error("No data!");
return await sql.run(
"INSERT INTO Veicle (id, type, model) VALUES ($id, $type, $model)",
data,
);
}
// Calling the function
create({
id: 0,
type: "car",
model: "uno"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment