https://github.com/kovstas/sqlite-sjs
Sqlite-sjs Client for Node.js App
https://github.com/kovstas/sqlite-sjs
Last synced: about 2 months ago
JSON representation
Sqlite-sjs Client for Node.js App
- Host: GitHub
- URL: https://github.com/kovstas/sqlite-sjs
- Owner: kovstas
- License: apache-2.0
- Created: 2018-01-19T16:57:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-30T20:49:49.000Z (over 7 years ago)
- Last Synced: 2024-10-30T01:51:13.591Z (7 months ago)
- Language: Scala
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sqlite-sjs Client for Node.js App
[](https://travis-ci.org/PepRoll/sqlite-sjs)
> A wrapper library that adds SQL-based migrations and some additional methods to
> [better-sqlite3](https://github.com/JoshuaWise/better-sqlite3)
> api documentations [docs](https://github.com/JoshuaWise/better-sqlite3/wiki/API)## Install
NPM project:
`npm install sqlite-sjs`
SBT project:
`libraryDependencies += "me.peproll" %%% "sqlite-sjs" % "0.0.3"`
## Usage
From js code:
```js
var Database = require('sqlite-sjs');
var db = new Database('foobar.db', options);var row = db.prepare('SELECT * FROM users WHERE id=?').get(userId);
console.log(row.firstName, row.lastName, row.email);
```From scala.js code:
```scala
@ScalaJSDefined
trait User extends js.Object {
def name: String = js.native
}val db = Sqlite("foobar.db", new ConnectionOptions())
var row = db.prepare("SELECT * FROM users WHERE id=?").get[User](userId)
println(s"Username: ${row.name}")
```## Migrations
## Some stuff