Skip to content
Permalink
d2a6180cf6
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
33 lines (30 sloc) 583 Bytes
'use strict'
/*
const sqlite = require('sqlite-async')
const db = await sqlite.open('./website.db')
await db.run('xxx')
const records = await db.get('xxx')
await db.close()
*/
module.exports.open = async name => {
// opens a connection
console.log(name)
return new DB()
}
class DB {
async run(query) {
// runs a query
console.log('run')
console.log(query)
}
async get(query) {
// runs a query and returns data
console.log('get')
console.log(query)
return ['bread', 'butter', 'cheese']
}
async close() {
// closes the connection
console.log('close')
}
}