soc-sql
v1.0.1
Published
Wrapper for [sql.js](https://github.com/sql-js/sql.js) for a quick blank SQLite instance.
Downloads
2
Readme
SOC-SQL
Wrapper for sql.js for a quick blank SQLite instance.
Usage
const { db } = require("soc-sql");
db.run("CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT);");
db.run("INSERT INTO users (name) VALUES ('ben');");
const res = db.exec("SELECT * FROM users");
console.log(res);
Example Setup
const { db } = require("soc-sql");
// const starterSql = "CREATE TABLE... and so on" (could be read from sql file)
// db.exec(staterSql)
module.exports = {
query: async (sql) => {
return db.exec(sql);
},
};