Skip to content

Latest commit

 

History

History
13 lines (8 loc) · 1.7 KB

README.md

File metadata and controls

13 lines (8 loc) · 1.7 KB

Build Status GoDoc

This package provides GopherJS bindings around SQL.js, and a database/sql/driver implementation, for use with the standard Go Database driver infrastructure.

SQL.js is SQLite compiled to JavaScript through Emscripten, which can run in the browser. If your goal is to use SQLite from Go, you should use mattn/go-sqlite3 or go-sqlite instead. If your intention is to use SQLite within GopherJS running on node.js, you should probably use the sqlite3 package instead (which as far as I know, has no GopherJS bindings at the moment).

To be clear: You should only use this package if you are writing code for GopherJS which must run in the browser.

This does not support storing databases on the filesystem--it only supports in-memory databases (which may be imported from binary blobs). The database/sql driver also does not support transactions (what value would they be in an in-memory, in-browser database, anyway?)

Build instructions

As this package provides bindings for a JavaScript package, naturally the JavaScript must be installed to successfully use these bindings. In your GopherJS package, which depends on this one, you can add a package.json which includes sql.js as a dependency, then run npm install prior to building the GopherJS package.