Skip to content

Instantly share code, notes, and snippets.

@neonerd
Created January 18, 2018 13:45
Show Gist options
  • Save neonerd/ae4844ac980317264974ca9ec3eee29e to your computer and use it in GitHub Desktop.
Save neonerd/ae4844ac980317264974ca9ec3eee29e to your computer and use it in GitHub Desktop.
const mssql = require("mssql")
const puresql = require("puresql")
// Load our queries
const queries = puresql.loadQueries("user.sql")
// Create a connection the adapter will use
mssql.connect('mssql://user:password@host/database')
.then(() => {
// Create the adapter
const adapter = puresql.adapters.mssql(mssql)
// Do something
async function foo() {
const rows = await queries.get({}, adapter)
rows.map(row => {
console.log('UserId: ' + row.UserId)
})
}
foo()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment