![]() func (SQLJSResult) LastInsertId() (int64, error).func (d *SQLJSDriver) Open(dsn string) (driver.Conn, error).func (c *SQLJSConn) Prepare(query string) (driver.Stmt, error).func (c *SQLJSConn) Begin() (driver.Tx, error).func AddReader(name string, reader io.Reader) error.Although writes are supported, there is currently no way to export the database using this To this end, this module is tested only for readingĭatabases. For such purposes, onlyĪ small subset of features is considered useful. This module existsįor one primary purpose: To be able to read SQLite3 databases from within a browser. SQL.js does not provide anything like a complete SQLite3 API, and this module even less so. Package sqljs provides a database/sql-compatible interface to SQL.js ( ) for GopherJS. ![]() 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. ![]() The database/sql driver also does not support transactions (what value would they be in an in-memory, in-browser database, anyway?) Build instructionsĪs this package provides bindings for a JavaScript package, naturally the JavaScript must be installed to successfully use these bindings. This does not support storing databases on the filesystem-it only supports in-memory databases (which may be imported from binary blobs). To be clear: You should only use this package if you are writing code for GopherJS which must run in the browser. 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). If your goal is to use SQLite from Go, you should use mattn/go-sqlite3 or go-sqlite instead. SQL.js is SQLite compiled to JavaScript through Emscripten, which can run in the browser. This package provides GopherJS bindings around SQL.js, and a database/sql/driver implementation, for use with the standard Go Database driver infrastructure.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |