Documentation
¶
Overview ¶
Package sqljs provides a database/sql-compatible interface to SQL.js (https://github.com/lovasoa/sql.js) for GopherJS.
SQL.js does not provide anything like a complete SQLite3 API, and this module even less so. This module exists for one primary purpose: To be able to read SQLite3 databases from within a browser. For such purposes, only a small subset of features is considered useful. To this end, this module is tested only for reading databases. Although writes are supported, there is currently no way to export the database using this package. Also, transactions are not supported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SQLJSConn ¶
Connection struct
type SQLJSDriver ¶
type SQLJSDriver struct{}
Driver struct. To load an existing database, you must register a new instance of this driver, with an io.Reader pointing to the SQLite3 database file. See Open() for an example.
func (*SQLJSDriver) Open ¶
func (d *SQLJSDriver) Open(dsn string) (driver.Conn, error)
Open will a new database instance. By default, it will create a new database in memory. To open an existing database, you must first register a new instance as the driver. The DSN string is always ignored.
Example:
driver := &sqljs.SQLJSDriver{} sql.Register("sqljs-reader", driver) file, _ := os.Open("/path/to/database.db") driver.Reader, _ = file db := sql.Open("sqljs-reader","")
type SQLJSResult ¶
type SQLJSResult struct {
// contains filtered or unexported fields
}
Result struct.
func (SQLJSResult) LastInsertId ¶
func (SQLJSResult) LastInsertId() (int64, error)
LastInsertId is not supported. It will always return an error.
func (*SQLJSResult) RowsAffected ¶
func (s *SQLJSResult) RowsAffected() (int64, error)
RowsAffected is not supported. It will always return an error.