Documentation ¶
Index ¶
- type SqliteJsConn
- func (conn *SqliteJsConn) Begin() (driver.Tx, error)
- func (conn *SqliteJsConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (conn SqliteJsConn) Close() error
- func (conn *SqliteJsConn) Exec(query string, args []driver.Value) (result driver.Result, err error)
- func (conn *SqliteJsConn) Prepare(query string) (stmt driver.Stmt, err error)
- type SqliteJsDriver
- type SqliteJsResult
- type SqliteJsRows
- type SqliteJsStmt
- func (s *SqliteJsStmt) Close() error
- func (s *SqliteJsStmt) Exec(args []driver.Value) (driver.Result, error)
- func (s *SqliteJsStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
- func (s *SqliteJsStmt) Next() *js.Value
- func (s *SqliteJsStmt) NumInput() int
- func (s *SqliteJsStmt) Query(args []driver.Value) (driver.Rows, error)deprecated
- func (s *SqliteJsStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
- type SqliteJsTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SqliteJsConn ¶
type SqliteJsConn struct { JsDb js.Value // sql.js SQL.Database : https://sql-js.github.io/sql.js/documentation/class/Database.html // contains filtered or unexported fields }
SqliteJsConn implements driver.Conn.
func (*SqliteJsConn) Begin ¶
func (conn *SqliteJsConn) Begin() (driver.Tx, error)
Begin starts a transaction. The default isolation level is dependent on the driver.
func (*SqliteJsConn) BeginTx ¶
BeginTx starts and returns a new transaction. If the context is canceled by the user the sql package will call Tx.Rollback before discarding and closing the connection.
This must check opts.Isolation to determine if there is a set isolation level. If the driver does not support a non-default level and one is set or if there is a non-default isolation level that is not supported, an error must be returned.
This must also check opts.ReadOnly to determine if the read-only value is true to either set the read-only transaction property if supported or return an error if it is not supported.
func (SqliteJsConn) Close ¶
func (conn SqliteJsConn) Close() error
Close returns the connection to the connection pool. All operations after a Close will return with ErrConnDone. Close is safe to call concurrently with other operations and will block until all other operations finish. It may be useful to first cancel any used context and then call close directly after.
func (*SqliteJsConn) Prepare ¶
func (conn *SqliteJsConn) Prepare(query string) (stmt driver.Stmt, err error)
Prepare creates a prepared statement for later queries or executions. Multiple queries or executions may be run concurrently from the returned statement. The caller must call the statement's Close method when the statement is no longer needed.
type SqliteJsDriver ¶
type SqliteJsDriver struct {
ConnectHook func(*SqliteJsConn) error
}
SqliteJsDriver implements driver.Driver.
type SqliteJsResult ¶
type SqliteJsResult struct {
// contains filtered or unexported fields
}
SqliteJsResult implements sql.Result.
func (*SqliteJsResult) LastInsertId ¶
func (r *SqliteJsResult) LastInsertId() (int64, error)
LastInsertId return last inserted ID.
func (*SqliteJsResult) RowsAffected ¶
func (r *SqliteJsResult) RowsAffected() (int64, error)
RowsAffected return how many rows affected.
type SqliteJsRows ¶
type SqliteJsRows struct {
// contains filtered or unexported fields
}
SqliteJsRows implements driver.Rows.
func (*SqliteJsRows) Columns ¶
func (r *SqliteJsRows) Columns() []string
Columns returns the names of the columns. The number of columns of the result is inferred from the length of the slice. If a particular column name isn't known, an empty string should be returned for that entry.
func (*SqliteJsRows) Next ¶
func (r *SqliteJsRows) Next(dest []driver.Value) error
Next is called to populate the next row of data into the provided slice. The provided slice will be the same size as the Columns() are wide.
Next should return io.EOF when there are no more rows.
The dest should not be written to outside of Next. Care should be taken when closing Rows not to modify a buffer held in dest.
type SqliteJsStmt ¶
type SqliteJsStmt struct {
// contains filtered or unexported fields
}
SqliteJsStmt implements driver.Stmt.
func (*SqliteJsStmt) Exec ¶
Exec executes a prepared statement with the given arguments and returns a Result summarizing the effect of the statement.
func (*SqliteJsStmt) ExecContext ¶
func (s *SqliteJsStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)
ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE.
ExecContext must honor the context timeout and return when it is canceled.
func (*SqliteJsStmt) Next ¶
func (s *SqliteJsStmt) Next() *js.Value
func (*SqliteJsStmt) NumInput ¶
func (s *SqliteJsStmt) NumInput() int
NumInput returns the number of placeholder parameters.
If NumInput returns >= 0, the sql package will sanity check argument counts from callers and return errors to the caller before the statement's Exec or Query methods are called.
NumInput may also return -1, if the driver doesn't know its number of placeholders. In that case, the sql package will not sanity check Exec or Query argument counts.
func (*SqliteJsStmt) QueryContext ¶
func (s *SqliteJsStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)
QueryContext executes a query that may return rows, such as a SELECT.
QueryContext must honor the context timeout and return when it is canceled.
type SqliteJsTx ¶
type SqliteJsTx struct {
// contains filtered or unexported fields
}
SqliteJsTx implements driver.Tx.
func (*SqliteJsTx) Rollback ¶
func (tx *SqliteJsTx) Rollback() error
Rollback aborts the transaction.