sqlite3

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

go-sqlite-lite is a SQLite driver for the Go programming language. It is designed to be simple, lightweight, performant, understandable, unsurprising, debuggable, ergonomic, and fully featured. This driver does not provide a database/sql interface.

Index

Constants

View Source
const (
	INTEGER = C.SQLITE_INTEGER // 1
	FLOAT   = C.SQLITE_FLOAT   // 2
	TEXT    = C.SQLITE_TEXT    // 3
	BLOB    = C.SQLITE_BLOB    // 4
	NULL    = C.SQLITE_NULL    // 5
)

Fundamental SQLite data types. These are returned by Stmt.DataTypes method. https://www.sqlite.org/c3ref/c_blob.html

View Source
const (
	OPEN_READONLY       = C.SQLITE_OPEN_READONLY       // Ok for sqlite3_open_v2()
	OPEN_READWRITE      = C.SQLITE_OPEN_READWRITE      // Ok for sqlite3_open_v2()
	OPEN_CREATE         = C.SQLITE_OPEN_CREATE         // Ok for sqlite3_open_v2()
	OPEN_DELETEONCLOSE  = C.SQLITE_OPEN_DELETEONCLOSE  // VFS only
	OPEN_EXCLUSIVE      = C.SQLITE_OPEN_EXCLUSIVE      // VFS only
	OPEN_AUTOPROXY      = C.SQLITE_OPEN_AUTOPROXY      // VFS only
	OPEN_URI            = C.SQLITE_OPEN_URI            // Ok for sqlite3_open_v2()
	OPEN_MEMORY         = C.SQLITE_OPEN_MEMORY         // Ok for sqlite3_open_v2()
	OPEN_MAIN_DB        = C.SQLITE_OPEN_MAIN_DB        // VFS only
	OPEN_TEMP_DB        = C.SQLITE_OPEN_TEMP_DB        // VFS only
	OPEN_TRANSIENT_DB   = C.SQLITE_OPEN_TRANSIENT_DB   // VFS only
	OPEN_MAIN_JOURNAL   = C.SQLITE_OPEN_MAIN_JOURNAL   // VFS only
	OPEN_TEMP_JOURNAL   = C.SQLITE_OPEN_TEMP_JOURNAL   // VFS only
	OPEN_SUBJOURNAL     = C.SQLITE_OPEN_SUBJOURNAL     // VFS only
	OPEN_MASTER_JOURNAL = C.SQLITE_OPEN_MASTER_JOURNAL // VFS only
	OPEN_NOMUTEX        = C.SQLITE_OPEN_NOMUTEX        // Ok for sqlite3_open_v2()
	OPEN_FULLMUTEX      = C.SQLITE_OPEN_FULLMUTEX      // Ok for sqlite3_open_v2()
	OPEN_SHAREDCACHE    = C.SQLITE_OPEN_SHAREDCACHE    // Ok for sqlite3_open_v2()
	OPEN_PRIVATECACHE   = C.SQLITE_OPEN_PRIVATECACHE   // Ok for sqlite3_open_v2()
	OPEN_WAL            = C.SQLITE_OPEN_WAL            // VFS only
)

Flags that can be provided to Open https://www.sqlite.org/c3ref/open.html

View Source
const (
	OK         = C.SQLITE_OK         // 0   = Successful result
	ERROR      = C.SQLITE_ERROR      // 1   = SQL error or missing database
	INTERNAL   = C.SQLITE_INTERNAL   // 2   = Internal logic error in SQLite
	PERM       = C.SQLITE_PERM       // 3   = Access permission denied
	ABORT      = C.SQLITE_ABORT      // 4   = Callback routine requested an abort
	BUSY       = C.SQLITE_BUSY       // 5   = The database file is locked
	LOCKED     = C.SQLITE_LOCKED     // 6   = A table in the database is locked
	NOMEM      = C.SQLITE_NOMEM      // 7   = A malloc() failed
	READONLY   = C.SQLITE_READONLY   // 8   = Attempt to write a readonly database
	INTERRUPT  = C.SQLITE_INTERRUPT  // 9   = Operation terminated by sqlite3_interrupt()
	IOERR      = C.SQLITE_IOERR      // 10  = Some kind of disk I/O error occurred
	CORRUPT    = C.SQLITE_CORRUPT    // 11  = The database disk image is malformed
	NOTFOUND   = C.SQLITE_NOTFOUND   // 12  = Unknown opcode in sqlite3_file_control()
	FULL       = C.SQLITE_FULL       // 13  = Insertion failed because database is full
	CANTOPEN   = C.SQLITE_CANTOPEN   // 14  = Unable to open the database file
	PROTOCOL   = C.SQLITE_PROTOCOL   // 15  = Database lock protocol error
	EMPTY      = C.SQLITE_EMPTY      // 16  = Database is empty
	SCHEMA     = C.SQLITE_SCHEMA     // 17  = The database schema changed
	TOOBIG     = C.SQLITE_TOOBIG     // 18  = String or BLOB exceeds size limit
	CONSTRAINT = C.SQLITE_CONSTRAINT // 19  = Abort due to constraint violation
	MISMATCH   = C.SQLITE_MISMATCH   // 20  = Data type mismatch
	MISUSE     = C.SQLITE_MISUSE     // 21  = Library used incorrectly
	NOLFS      = C.SQLITE_NOLFS      // 22  = Uses OS features not supported on host
	AUTH       = C.SQLITE_AUTH       // 23  = Authorization denied
	FORMAT     = C.SQLITE_FORMAT     // 24  = Auxiliary database format error
	RANGE      = C.SQLITE_RANGE      // 25  = 2nd parameter to sqlite3_bind out of range
	NOTADB     = C.SQLITE_NOTADB     // 26  = File opened that is not a database file
	NOTICE     = C.SQLITE_NOTICE     // 27  = Notifications from sqlite3_log()
	WARNING    = C.SQLITE_WARNING    // 28  = Warnings from sqlite3_log()
	ROW        = C.SQLITE_ROW        // 100 = sqlite3_step() has another row ready
	DONE       = C.SQLITE_DONE       // 101 = sqlite3_step() has finished executing
)

General result codes returned by the SQLite API. When converted to an error, OK and ROW become nil, and DONE becomes either nil or io.EOF, depending on the context in which the statement is executed. All other codes are returned via the Error struct. https://www.sqlite.org/c3ref/c_abort.html

View Source
const (
	IOERR_READ              = C.SQLITE_IOERR_READ              // (SQLITE_IOERR | (1<<8))
	IOERR_SHORT_READ        = C.SQLITE_IOERR_SHORT_READ        // (SQLITE_IOERR | (2<<8))
	IOERR_WRITE             = C.SQLITE_IOERR_WRITE             // (SQLITE_IOERR | (3<<8))
	IOERR_FSYNC             = C.SQLITE_IOERR_FSYNC             // (SQLITE_IOERR | (4<<8))
	IOERR_DIR_FSYNC         = C.SQLITE_IOERR_DIR_FSYNC         // (SQLITE_IOERR | (5<<8))
	IOERR_TRUNCATE          = C.SQLITE_IOERR_TRUNCATE          // (SQLITE_IOERR | (6<<8))
	IOERR_FSTAT             = C.SQLITE_IOERR_FSTAT             // (SQLITE_IOERR | (7<<8))
	IOERR_UNLOCK            = C.SQLITE_IOERR_UNLOCK            // (SQLITE_IOERR | (8<<8))
	IOERR_RDLOCK            = C.SQLITE_IOERR_RDLOCK            // (SQLITE_IOERR | (9<<8))
	IOERR_DELETE            = C.SQLITE_IOERR_DELETE            // (SQLITE_IOERR | (10<<8))
	IOERR_BLOCKED           = C.SQLITE_IOERR_BLOCKED           // (SQLITE_IOERR | (11<<8))
	IOERR_NOMEM             = C.SQLITE_IOERR_NOMEM             // (SQLITE_IOERR | (12<<8))
	IOERR_ACCESS            = C.SQLITE_IOERR_ACCESS            // (SQLITE_IOERR | (13<<8))
	IOERR_CHECKRESERVEDLOCK = C.SQLITE_IOERR_CHECKRESERVEDLOCK // (SQLITE_IOERR | (14<<8))
	IOERR_LOCK              = C.SQLITE_IOERR_LOCK              // (SQLITE_IOERR | (15<<8))
	IOERR_CLOSE             = C.SQLITE_IOERR_CLOSE             // (SQLITE_IOERR | (16<<8))
	IOERR_DIR_CLOSE         = C.SQLITE_IOERR_DIR_CLOSE         // (SQLITE_IOERR | (17<<8))
	IOERR_SHMOPEN           = C.SQLITE_IOERR_SHMOPEN           // (SQLITE_IOERR | (18<<8))
	IOERR_SHMSIZE           = C.SQLITE_IOERR_SHMSIZE           // (SQLITE_IOERR | (19<<8))
	IOERR_SHMLOCK           = C.SQLITE_IOERR_SHMLOCK           // (SQLITE_IOERR | (20<<8))
	IOERR_SHMMAP            = C.SQLITE_IOERR_SHMMAP            // (SQLITE_IOERR | (21<<8))
	IOERR_SEEK              = C.SQLITE_IOERR_SEEK              // (SQLITE_IOERR | (22<<8))
	IOERR_DELETE_NOENT      = C.SQLITE_IOERR_DELETE_NOENT      // (SQLITE_IOERR | (23<<8))
	IOERR_MMAP              = C.SQLITE_IOERR_MMAP              // (SQLITE_IOERR | (24<<8))
	IOERR_GETTEMPPATH       = C.SQLITE_IOERR_GETTEMPPATH       // (SQLITE_IOERR | (25<<8))
	IOERR_CONVPATH          = C.SQLITE_IOERR_CONVPATH          // (SQLITE_IOERR | (26<<8))
	LOCKED_SHAREDCACHE      = C.SQLITE_LOCKED_SHAREDCACHE      // (SQLITE_LOCKED |  (1<<8))
	BUSY_RECOVERY           = C.SQLITE_BUSY_RECOVERY           // (SQLITE_BUSY   |  (1<<8))
	BUSY_SNAPSHOT           = C.SQLITE_BUSY_SNAPSHOT           // (SQLITE_BUSY   |  (2<<8))
	CANTOPEN_NOTEMPDIR      = C.SQLITE_CANTOPEN_NOTEMPDIR      // (SQLITE_CANTOPEN | (1<<8))
	CANTOPEN_ISDIR          = C.SQLITE_CANTOPEN_ISDIR          // (SQLITE_CANTOPEN | (2<<8))
	CANTOPEN_FULLPATH       = C.SQLITE_CANTOPEN_FULLPATH       // (SQLITE_CANTOPEN | (3<<8))
	CANTOPEN_CONVPATH       = C.SQLITE_CANTOPEN_CONVPATH       // (SQLITE_CANTOPEN | (4<<8))
	CORRUPT_VTAB            = C.SQLITE_CORRUPT_VTAB            // (SQLITE_CORRUPT | (1<<8))
	READONLY_RECOVERY       = C.SQLITE_READONLY_RECOVERY       // (SQLITE_READONLY | (1<<8))
	READONLY_CANTLOCK       = C.SQLITE_READONLY_CANTLOCK       // (SQLITE_READONLY | (2<<8))
	READONLY_ROLLBACK       = C.SQLITE_READONLY_ROLLBACK       // (SQLITE_READONLY | (3<<8))
	READONLY_DBMOVED        = C.SQLITE_READONLY_DBMOVED        // (SQLITE_READONLY | (4<<8))
	ABORT_ROLLBACK          = C.SQLITE_ABORT_ROLLBACK          // (SQLITE_ABORT | (2<<8))
	CONSTRAINT_CHECK        = C.SQLITE_CONSTRAINT_CHECK        // (SQLITE_CONSTRAINT | (1<<8))
	CONSTRAINT_COMMITHOOK   = C.SQLITE_CONSTRAINT_COMMITHOOK   // (SQLITE_CONSTRAINT | (2<<8))
	CONSTRAINT_FOREIGNKEY   = C.SQLITE_CONSTRAINT_FOREIGNKEY   // (SQLITE_CONSTRAINT | (3<<8))
	CONSTRAINT_FUNCTION     = C.SQLITE_CONSTRAINT_FUNCTION     // (SQLITE_CONSTRAINT | (4<<8))
	CONSTRAINT_NOTNULL      = C.SQLITE_CONSTRAINT_NOTNULL      // (SQLITE_CONSTRAINT | (5<<8))
	CONSTRAINT_PRIMARYKEY   = C.SQLITE_CONSTRAINT_PRIMARYKEY   // (SQLITE_CONSTRAINT | (6<<8))
	CONSTRAINT_TRIGGER      = C.SQLITE_CONSTRAINT_TRIGGER      // (SQLITE_CONSTRAINT | (7<<8))
	CONSTRAINT_UNIQUE       = C.SQLITE_CONSTRAINT_UNIQUE       // (SQLITE_CONSTRAINT | (8<<8))
	CONSTRAINT_VTAB         = C.SQLITE_CONSTRAINT_VTAB         // (SQLITE_CONSTRAINT | (9<<8))
	CONSTRAINT_ROWID        = C.SQLITE_CONSTRAINT_ROWID        // (SQLITE_CONSTRAINT |(10<<8))
	NOTICE_RECOVER_WAL      = C.SQLITE_NOTICE_RECOVER_WAL      // (SQLITE_NOTICE | (1<<8))
	NOTICE_RECOVER_ROLLBACK = C.SQLITE_NOTICE_RECOVER_ROLLBACK // (SQLITE_NOTICE | (2<<8))
	WARNING_AUTOINDEX       = C.SQLITE_WARNING_AUTOINDEX       // (SQLITE_WARNING | (1<<8))
)

Extended result codes returned by the SQLite API. Extended result codes are enabled by default for all new Conn objects. Use Error.Code()&0xFF to convert an extended code to a general one. https://www.sqlite.org/c3ref/c_abort_rollback.html

View Source
const (
	CREATE_INDEX        = C.SQLITE_CREATE_INDEX        // 1
	CREATE_TABLE        = C.SQLITE_CREATE_TABLE        // 2
	CREATE_TEMP_INDEX   = C.SQLITE_CREATE_TEMP_INDEX   // 3
	CREATE_TEMP_TABLE   = C.SQLITE_CREATE_TEMP_TABLE   // 4
	CREATE_TEMP_TRIGGER = C.SQLITE_CREATE_TEMP_TRIGGER // 5
	CREATE_TEMP_VIEW    = C.SQLITE_CREATE_TEMP_VIEW    // 6
	CREATE_TRIGGER      = C.SQLITE_CREATE_TRIGGER      // 7
	CREATE_VIEW         = C.SQLITE_CREATE_VIEW         // 8
	DELETE              = C.SQLITE_DELETE              // 9
	DROP_INDEX          = C.SQLITE_DROP_INDEX          // 10
	DROP_TABLE          = C.SQLITE_DROP_TABLE          // 11
	DROP_TEMP_INDEX     = C.SQLITE_DROP_TEMP_INDEX     // 12
	DROP_TEMP_TABLE     = C.SQLITE_DROP_TEMP_TABLE     // 13
	DROP_TEMP_TRIGGER   = C.SQLITE_DROP_TEMP_TRIGGER   // 14
	DROP_TEMP_VIEW      = C.SQLITE_DROP_TEMP_VIEW      // 15
	DROP_TRIGGER        = C.SQLITE_DROP_TRIGGER        // 16
	DROP_VIEW           = C.SQLITE_DROP_VIEW           // 17
	INSERT              = C.SQLITE_INSERT              // 18
	PRAGMA              = C.SQLITE_PRAGMA              // 19
	READ                = C.SQLITE_READ                // 20
	SELECT              = C.SQLITE_SELECT              // 21
	TRANSACTION         = C.SQLITE_TRANSACTION         // 22
	UPDATE              = C.SQLITE_UPDATE              // 23
	ATTACH              = C.SQLITE_ATTACH              // 24
	DETACH              = C.SQLITE_DETACH              // 25
	ALTER_TABLE         = C.SQLITE_ALTER_TABLE         // 26
	REINDEX             = C.SQLITE_REINDEX             // 27
	ANALYZE             = C.SQLITE_ANALYZE             // 28
	CREATE_VTABLE       = C.SQLITE_CREATE_VTABLE       // 29
	DROP_VTABLE         = C.SQLITE_DROP_VTABLE         // 30
	FUNCTION            = C.SQLITE_FUNCTION            // 31
	SAVEPOINT           = C.SQLITE_SAVEPOINT           // 32
	RECURSIVE           = C.SQLITE_RECURSIVE           // 33
)

Codes used by SQLite to indicate the operation type when invoking authorizer and row update callbacks. https://www.sqlite.org/c3ref/c_alter_table.html

View Source
const (
	STATUS_MEMORY_USED        = C.SQLITE_STATUS_MEMORY_USED        // 0
	STATUS_PAGECACHE_USED     = C.SQLITE_STATUS_PAGECACHE_USED     // 1
	STATUS_PAGECACHE_OVERFLOW = C.SQLITE_STATUS_PAGECACHE_OVERFLOW // 2
	STATUS_SCRATCH_USED       = C.SQLITE_STATUS_SCRATCH_USED       // 3
	STATUS_SCRATCH_OVERFLOW   = C.SQLITE_STATUS_SCRATCH_OVERFLOW   // 4
	STATUS_MALLOC_SIZE        = C.SQLITE_STATUS_MALLOC_SIZE        // 5
	STATUS_PARSER_STACK       = C.SQLITE_STATUS_PARSER_STACK       // 6
	STATUS_PAGECACHE_SIZE     = C.SQLITE_STATUS_PAGECACHE_SIZE     // 7
	STATUS_SCRATCH_SIZE       = C.SQLITE_STATUS_SCRATCH_SIZE       // 8
	STATUS_MALLOC_COUNT       = C.SQLITE_STATUS_MALLOC_COUNT       // 9
)

Core SQLite performance counters that can be queried with Status. https://www.sqlite.org/c3ref/c_status_malloc_count.html

View Source
const (
	DBSTATUS_LOOKASIDE_USED      = C.SQLITE_DBSTATUS_LOOKASIDE_USED      // 0
	DBSTATUS_CACHE_USED          = C.SQLITE_DBSTATUS_CACHE_USED          // 1
	DBSTATUS_SCHEMA_USED         = C.SQLITE_DBSTATUS_SCHEMA_USED         // 2
	DBSTATUS_STMT_USED           = C.SQLITE_DBSTATUS_STMT_USED           // 3
	DBSTATUS_LOOKASIDE_HIT       = C.SQLITE_DBSTATUS_LOOKASIDE_HIT       // 4
	DBSTATUS_LOOKASIDE_MISS_SIZE = C.SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE // 5
	DBSTATUS_LOOKASIDE_MISS_FULL = C.SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL // 6
	DBSTATUS_CACHE_HIT           = C.SQLITE_DBSTATUS_CACHE_HIT           // 7
	DBSTATUS_CACHE_MISS          = C.SQLITE_DBSTATUS_CACHE_MISS          // 8
	DBSTATUS_CACHE_WRITE         = C.SQLITE_DBSTATUS_CACHE_WRITE         // 9
	DBSTATUS_DEFERRED_FKS        = C.SQLITE_DBSTATUS_DEFERRED_FKS        // 10
)

Connection performance counters that can be queried with Conn.Status. https://www.sqlite.org/c3ref/c_dbstatus_options.html

View Source
const (
	STMTSTATUS_FULLSCAN_STEP = C.SQLITE_STMTSTATUS_FULLSCAN_STEP // 1
	STMTSTATUS_SORT          = C.SQLITE_STMTSTATUS_SORT          // 2
	STMTSTATUS_AUTOINDEX     = C.SQLITE_STMTSTATUS_AUTOINDEX     // 3
	STMTSTATUS_VM_STEP       = C.SQLITE_STMTSTATUS_VM_STEP       // 4
)

Statement performance counters that can be queried with Stmt.Status. https://www.sqlite.org/c3ref/c_stmtstatus_counter.html

View Source
const (
	LIMIT_LENGTH              = C.SQLITE_LIMIT_LENGTH              // 0
	LIMIT_SQL_LENGTH          = C.SQLITE_LIMIT_SQL_LENGTH          // 1
	LIMIT_COLUMN              = C.SQLITE_LIMIT_COLUMN              // 2
	LIMIT_EXPR_DEPTH          = C.SQLITE_LIMIT_EXPR_DEPTH          // 3
	LIMIT_COMPOUND_SELECT     = C.SQLITE_LIMIT_COMPOUND_SELECT     // 4
	LIMIT_VDBE_OP             = C.SQLITE_LIMIT_VDBE_OP             // 5
	LIMIT_FUNCTION_ARG        = C.SQLITE_LIMIT_FUNCTION_ARG        // 6
	LIMIT_ATTACHED            = C.SQLITE_LIMIT_ATTACHED            // 7
	LIMIT_LIKE_PATTERN_LENGTH = C.SQLITE_LIMIT_LIKE_PATTERN_LENGTH // 8
	LIMIT_VARIABLE_NUMBER     = C.SQLITE_LIMIT_VARIABLE_NUMBER     // 9
	LIMIT_TRIGGER_DEPTH       = C.SQLITE_LIMIT_TRIGGER_DEPTH       // 10
)

Per-connection limits that can be queried and changed with Conn.Limit. https://www.sqlite.org/c3ref/c_limit_attached.html

View Source
const (
	CHANGESET_DATA        = C.SQLITE_CHANGESET_DATA
	CHANGESET_NOTFOUND    = C.SQLITE_CHANGESET_NOTFOUND
	CHANGESET_CONFLICT    = C.SQLITE_CHANGESET_CONFLICT
	CHANGESET_CONSTRAINT  = C.SQLITE_CHANGESET_CONSTRAINT
	CHANGESET_FOREIGN_KEY = C.SQLITE_CHANGESET_FOREIGN_KEY
)
View Source
const (
	CHANGESET_OMIT    = C.SQLITE_CHANGESET_OMIT
	CHANGESET_ABORT   = C.SQLITE_CHANGESET_ABORT
	CHANGESET_REPLACE = C.SQLITE_CHANGESET_REPLACE
)

Variables

View Source
var (
	ErrBadConn   = &Error{MISUSE, "closed or invalid connection"}
	ErrBadIO     = &Error{MISUSE, "closed or invalid incremental I/O operation"}
	ErrBadBackup = &Error{MISUSE, "closed or invalid backup operation"}
)

Errors returned for access attempts to closed or invalid objects.

View Source
var ErrBlobFull = &Error{ERROR, "incremental write failed, no space left"}

ErrBlobFull is returned by BlobIO.Write when there isn't enough space left to write the provided bytes.

Functions

func Complete

func Complete(sql string) bool

Complete returns true if sql appears to contain a complete statement that is ready to be parsed. This does not validate the statement syntax. https://www.sqlite.org/c3ref/complete.html

func ReleaseMemory

func ReleaseMemory(n int) int

ReleaseMemory attempts to free n bytes of heap memory by deallocating non-essential memory held by the SQLite library. It returns the number of bytes actually freed.

This function is currently a no-op because SQLite is not compiled with the SQLITE_ENABLE_MEMORY_MANAGEMENT option. https://www.sqlite.org/c3ref/release_memory.html

func SoftHeapLimit

func SoftHeapLimit(n int64) int64

SoftHeapLimit sets and/or queries the soft limit on the amount of heap memory that may be allocated by SQLite. A negative value for n keeps the current limit, while 0 removes the limit. The previous limit value is returned, with negative values indicating an error. https://www.sqlite.org/c3ref/soft_heap_limit64.html

func SourceID

func SourceID() string

SourceID returns the check-in identifier of SQLite within its configuration management system. https://www.sqlite.org/c3ref/c_source_id.html

func Status

func Status(op int, reset bool) (cur, peak int, err error)

Status returns the current and peak values of a core performance counter, specified by one of the STATUS constants. If reset is true, the peak value is reset back down to the current value after retrieval. https://www.sqlite.org/c3ref/status.html

func Version

func Version() string

Version returns the SQLite version as a string in the format "X.Y.Z[.N]". https://www.sqlite.org/c3ref/libversion.html

func VersionNum

func VersionNum() int

VersionNum returns the SQLite version as an integer in the format X*1000000 + Y*1000 + Z, where X is the major version, Y is the minor version, and Z is the release number.

Types

type AuthorizerFunc added in v0.6.1

type AuthorizerFunc func(op int, arg1, arg2, db, entity RawString) int

AuthorizerFunc is a callback function invoked by SQLite when statement is compiled.

type Backup

type Backup struct {
	// contains filtered or unexported fields
}

Backup is a handle to an online backup operation between two databases. https://www.sqlite.org/c3ref/backup.html

func (*Backup) Close

func (b *Backup) Close() error

Close releases all resources associated with the backup operation. It is safe to call this method prior to backup completion to abort the operation. https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupfinish

func (*Backup) Conn

func (b *Backup) Conn() (src, dst *Conn)

Conn returns the source and destination connections that are used by this backup operation. The destination connection must not be used until the backup operation is closed.

func (*Backup) Progress

func (b *Backup) Progress() (remaining, total int)

Progress returns the number of pages that still need to be backed up and the total number of pages in the source database. The values are updated after each call to Step and are reset to 0 after the backup is closed. The total number of pages may change if the source database is modified during the backup operation. https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupremaining

func (*Backup) Step

func (b *Backup) Step(n int) error

Step copies up to n pages to the destination database. If n is negative, all remaining pages are copied. io.EOF is returned upon successful backup completion. https://www.sqlite.org/c3ref/backup_finish.html#sqlite3backupstep

type BlobIO

type BlobIO struct {
	// contains filtered or unexported fields
}

BlobIO is a handle to a single BLOB (binary large object) or TEXT value opened for incremental I/O. This allows the value to be treated as a file for reading and writing. The value length cannot be changed using this API; use an UPDATE statement for that. The recommended way of allocating space for a BLOB is to use the ZeroBlob type or the zeroblob() SQL function. https://www.sqlite.org/c3ref/blob.html

func (*BlobIO) Close

func (b *BlobIO) Close() error

Close releases all resources associated with the incremental I/O operation. It is important to check the error returned by this method, since disk I/O and other types of errors may not be reported until the changes are actually committed to the database. https://www.sqlite.org/c3ref/blob_close.html

func (*BlobIO) Conn

func (b *BlobIO) Conn() *Conn

Conn returns the connection that that created this incremental I/O operation.

func (*BlobIO) Len

func (b *BlobIO) Len() int

Len returns the length of the BLOB/TEXT value in bytes. It is not possible to read/write/seek beyond this length. The length changes to 0 if the I/O handle expires due to an update of any column in the same row. This condition is indicated by an ABORT error code returned from Read or Write. An expired handle is closed automatically and cannot be reopened. Any writes that occurred before the abort are not rolled back. https://www.sqlite.org/c3ref/blob_bytes.html

func (*BlobIO) Read

func (b *BlobIO) Read(p []byte) (n int, err error)

Read implements the io.Reader interface. https://www.sqlite.org/c3ref/blob_read.html

func (*BlobIO) Reopen

func (b *BlobIO) Reopen(row int64) error

Reopen closes the current value and opens another one in the same column, specified by its ROWID. If an error is encountered, the I/O handle becomes unusable and is automatically closed. https://www.sqlite.org/c3ref/blob_reopen.html

func (*BlobIO) Row

func (b *BlobIO) Row() int64

Row returns the ROWID of the row containing the BLOB/TEXT value.

func (*BlobIO) Seek

func (b *BlobIO) Seek(offset int64, whence int) (ret int64, err error)

Seek implements the io.Seeker interface.

func (*BlobIO) Write

func (b *BlobIO) Write(p []byte) (n int, err error)

Write implements the io.Writer interface. The number of bytes written is always either 0 or len(p). ErrBlobFull is returned if there isn't enough space left to write all of p. https://www.sqlite.org/c3ref/blob_write.html

type BusyFunc added in v0.4.0

type BusyFunc func(count int) (retry bool)

BusyFunc is a callback function invoked by SQLite when it is unable to acquire a lock on a table. Count is the number of times that the callback has been invoked for this locking event so far. If the function returns false, then the operation is aborted. Otherwise, the function should block for a while before returning true and letting SQLite make another locking attempt.

type Changegroup added in v0.4.0

type Changegroup struct {
	// contains filtered or unexported fields
}

func (Changegroup) Add added in v0.4.0

func (cg Changegroup) Add(r io.Reader) error

https://www.sqlite.org/session/sqlite3changegroup_add.html

func (Changegroup) Delete added in v0.4.0

func (cg Changegroup) Delete()

Delete deletes a Changegroup.

https://www.sqlite.org/session/sqlite3changegroup_delete.html

func (Changegroup) Output added in v0.4.0

func (cg Changegroup) Output(w io.Writer) (err error)

https://www.sqlite.org/session/sqlite3changegroup_output.html

type ChangesetIter added in v0.4.0

type ChangesetIter struct {
	// contains filtered or unexported fields
}

func (ChangesetIter) Close added in v0.4.0

func (iter ChangesetIter) Close() error

https://www.sqlite.org/session/sqlite3changeset_finalize.html

func (ChangesetIter) Conflict added in v0.4.0

func (iter ChangesetIter) Conflict(col int) (v Value, err error)

https://www.sqlite.org/session/sqlite3changeset_conflict.html

func (ChangesetIter) FKConflicts added in v0.4.0

func (iter ChangesetIter) FKConflicts() (int, error)

https://www.sqlite.org/session/sqlite3changeset_fk_conflicts.html

func (ChangesetIter) New added in v0.4.0

func (iter ChangesetIter) New(col int) (v Value, err error)

https://www.sqlite.org/session/sqlite3changeset_new.html

func (ChangesetIter) Next added in v0.4.0

func (iter ChangesetIter) Next() (rowReturned bool, err error)

func (ChangesetIter) Old added in v0.4.0

func (iter ChangesetIter) Old(col int) (v Value, err error)

https://www.sqlite.org/session/sqlite3changeset_old.html

func (ChangesetIter) Op added in v0.4.0

func (iter ChangesetIter) Op() (table string, numCols int, opType OpType, indirect bool, err error)

https://www.sqlite.org/session/sqlite3changeset_op.html

func (ChangesetIter) PK added in v0.4.0

func (iter ChangesetIter) PK() ([]bool, error)

https://www.sqlite.org/session/sqlite3changeset_pk.html

type CommitFunc added in v0.4.0

type CommitFunc func() (abort bool)

CommitFunc is a callback function invoked by SQLite before a transaction is committed. If the function returns true, the transaction is rolled back.

type ConflictAction added in v0.4.0

type ConflictAction int

type ConflictType added in v0.4.0

type ConflictType int

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a connection handle, which may have multiple databases attached to it by using the ATTACH SQL statement. https://www.sqlite.org/c3ref/sqlite3.html

func Open

func Open(name string, flagArgs ...int) (*Conn, error)

Open creates a new connection to a SQLite database. The name can be 1) a path to a file, which is created if it does not exist, 2) a URI using the syntax described at https://www.sqlite.org/uri.html, 3) the string ":memory:", which creates a temporary in-memory database, or 4) an empty string, which creates a temporary on-disk database (deleted when closed) in the directory returned by os.TempDir(). Flags to Open can optionally be provided. If no flags are provided, the default flags of OPEN_READWRITE|OPEN_CREATE are used. https://www.sqlite.org/c3ref/open.html

func (*Conn) AuthorizerFunc added in v0.6.1

func (c *Conn) AuthorizerFunc(f AuthorizerFunc) (prev AuthorizerFunc)

AuthorizerFunc registers a function that is invoked by SQLite During sql statement compilation. Function can return sqlite3.OK to accept statement, sqlite3.IGNORE to disallow specyfic action, but allow further statement processing, or sqlite3.DENY to deny action completly and stop processing. https://www.sqlite.org/c3ref/set_authorizer.html

func (*Conn) AutoCommit

func (c *Conn) AutoCommit() bool

AutoCommit returns true if the database connection is in auto-commit mode (i.e. outside of an explicit transaction started by BEGIN). https://www.sqlite.org/c3ref/get_autocommit.html

func (*Conn) Backup

func (c *Conn) Backup(srcName string, dst *Conn, dstName string) (*Backup, error)

Backup starts an online database backup of c.srcName into dst.dstName. Connections c and dst must be distinct. All existing contents of the destination database are overwritten.

A read lock is acquired on the source database only while it is being read during a call to Backup.Step. The source connection may be used for other purposes between these calls. The destination connection must not be used for anything until the backup is closed. https://www.sqlite.org/backup.html

func (*Conn) Begin

func (c *Conn) Begin() error

Begin starts a new deferred transaction. This is equivalent to c.Exec("BEGIN") https://www.sqlite.org/lang_transaction.html

func (*Conn) BeginExclusive

func (c *Conn) BeginExclusive() error

BeginExclusive starts a new exclusive transaction. This is equivalent to c.Exec("BEGIN EXCLUSIVE") https://www.sqlite.org/lang_transaction.html

func (*Conn) BeginImmediate

func (c *Conn) BeginImmediate() error

BeginImmediate starts a new immediate transaction. This is equivalent to c.Exec("BEGIN IMMEDIATE") https://www.sqlite.org/lang_transaction.html

func (*Conn) BlobIO

func (c *Conn) BlobIO(db, tbl, col string, row int64, rw bool) (*BlobIO, error)

BlobIO opens a BLOB or TEXT value for incremental I/O, allowing the value to be treated as a file for reading and/or writing. The value is located as if by the following query:

SELECT col FROM db.tbl WHERE rowid=row

If rw is true, the value is opened with read-write access, otherwise it is read-only. It is not possible to open a column that is part of an index or primary key for writing. If foreign key constraints are enabled, it is not possible to open a column that is part of a child key for writing. https://www.sqlite.org/c3ref/blob_open.html

func (*Conn) BusyFunc added in v0.4.0

func (c *Conn) BusyFunc(f BusyFunc)

BusyFunc registers a function that is invoked by SQLite when it is unable to acquire a lock on a table. The function f should return true to make another lock acquisition attempt, or false to let the operation fail with BUSY or IOERR_BLOCKED error code. https://www.sqlite.org/c3ref/busy_handler.html

func (*Conn) BusyTimeout

func (c *Conn) BusyTimeout(d time.Duration)

BusyTimeout enables the built-in busy handler, which retries the table locking operation for the specified duration before aborting. The busy handler is disabled if d is negative or zero. https://www.sqlite.org/c3ref/busy_timeout.html

func (*Conn) Changes

func (c *Conn) Changes() int

Changes returns the number of rows that were changed, inserted, or deleted by the most recent statement. Auxiliary changes caused by triggers or foreign key actions are not counted. https://www.sqlite.org/c3ref/changes.html

func (*Conn) ChangesetApply added in v0.4.0

func (conn *Conn) ChangesetApply(r io.Reader, filterFn func(tableName string) bool, conflictFn func(ConflictType, ChangesetIter) ConflictAction) error

https://www.sqlite.org/session/sqlite3changeset_apply.html

func (*Conn) Close

func (c *Conn) Close() error

Close releases all resources associated with the connection. If any prepared statements, incremental I/O operations, or backup operations are still active, the connection becomes an unusable "zombie" and is closed after all remaining statements and operations are destroyed. A BUSY error code is returned if the connection is left in this "zombie" status, which may indicate a programming error where some previously allocated resource is not properly released. https://www.sqlite.org/c3ref/close.html

func (*Conn) Commit

func (c *Conn) Commit() error

Commit saves all changes made within a transaction to the database.

func (*Conn) CommitFunc added in v0.4.0

func (c *Conn) CommitFunc(f CommitFunc) (prev CommitFunc)

CommitFunc registers a function that is invoked by SQLite before a transaction is committed. It returns the previous commit handler, if any. If the function f returns true, the transaction is rolled back instead, causing the rollback handler to be invoked, if one is registered. https://www.sqlite.org/c3ref/commit_hook.html

func (*Conn) CreateSession added in v0.4.0

func (conn *Conn) CreateSession(db string) (*Session, error)

CreateSession creates a new session object. https://www.sqlite.org/session/sqlite3session_create.html

func (*Conn) Exec

func (c *Conn) Exec(sql string, args ...interface{}) error

Exec is a convenience function that will call sqlite3_exec if no argument are given. If arguments are given, it's simply a convenient way to Prepare a statement, Bind arguments, Step the statement to completion, and Close/finalize the statement. https://www.sqlite.org/c3ref/exec.html

func (*Conn) FileName

func (c *Conn) FileName(db string) string

FileName returns the full file path of an attached database. An empty string is returned for temporary databases. https://www.sqlite.org/c3ref/db_filename.html

func (*Conn) Interrupt

func (c *Conn) Interrupt()

Interrupt causes any pending database operation to abort and return at its earliest opportunity. It is safe to call this method from a goroutine different from the one that is currently running the database operation, but it is not safe to call this method on a connection that might close before the call returns. https://www.sqlite.org/c3ref/interrupt.html

func (*Conn) LastInsertRowID

func (c *Conn) LastInsertRowID() int64

LastInsertRowID returns the ROWID of the most recent successful INSERT statement. https://www.sqlite.org/c3ref/last_insert_rowid.html

func (*Conn) Limit

func (c *Conn) Limit(id, value int) (prev int)

Limit changes a per-connection resource usage or performance limit, specified by one of the LIMIT constants, returning its previous value. If the new value is negative, the limit is left unchanged and its current value is returned. https://www.sqlite.org/c3ref/limit.html

func (*Conn) Prepare

func (c *Conn) Prepare(sql string, args ...interface{}) (s *Stmt, err error)

Prepare compiles the first statement in sql. Any remaining text after the first statement is saved in s.Tail. This function may return a nil stmt and a nil error, if the sql string contains nothing to do. For convenience, this function can also bind arguments to the returned statement. If an error occurs during binding, the statement is closed/finalized and the error is returned. https://www.sqlite.org/c3ref/prepare.html

func (*Conn) Rollback

func (c *Conn) Rollback() error

Rollback aborts the current transaction without saving any changes.

func (*Conn) RollbackFunc added in v0.4.0

func (c *Conn) RollbackFunc(f RollbackFunc) (prev RollbackFunc)

RollbackFunc registers a function that is invoked by SQLite when a transaction is rolled back. It returns the previous rollback handler, if any. https://www.sqlite.org/c3ref/commit_hook.html

func (*Conn) Status

func (c *Conn) Status(op int, reset bool) (cur, peak int, err error)

Status returns the current and peak values of a connection performance counter, specified by one of the DBSTATUS constants. If reset is true, the peak value is reset back down to the current value after retrieval. https://www.sqlite.org/c3ref/db_status.html

func (*Conn) TotalChanges

func (c *Conn) TotalChanges() int

TotalChanges returns the number of rows that were changed, inserted, or deleted since the database connection was opened, including changes caused by trigger and foreign key actions. https://www.sqlite.org/c3ref/total_changes.html

func (*Conn) UpdateFunc added in v0.4.0

func (c *Conn) UpdateFunc(f UpdateFunc) (prev UpdateFunc)

UpdateFunc registers a function that is invoked by SQLite when a row is updated, inserted, or deleted. It returns the previous update handler, if any. https://www.sqlite.org/c3ref/update_hook.html

func (*Conn) WithTx added in v0.1.2

func (c *Conn) WithTx(f func() error) error

WithTx is a convenience method that begins a deferred transaction, calls the function f, and will commit the transaction if f does not return an error, and will roll back the transaction if f does return an error.

func (*Conn) WithTxExclusive added in v0.1.2

func (c *Conn) WithTxExclusive(f func() error) error

WithTxExclusive is a convenience method that begins a exclusive transaction, calls the function f, and will commit the transaction if f does not return an error, and will roll back the transaction if f does return an error.

func (*Conn) WithTxImmediate added in v0.1.2

func (c *Conn) WithTxImmediate(f func() error) error

WithTxImmediate is a convenience method that begins an immediate transaction, calls the function f, and will commit the transaction if f does not return an error, and will roll back the transaction if f does return an error.

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is returned for all SQLite API result codes other than OK, ROW, and DONE.

func NewError

func NewError(rc int, msg string) *Error

NewError creates a new Error instance using the specified SQLite result code and error message.

func (*Error) Code

func (err *Error) Code() int

Code returns the SQLite extended result code.

func (*Error) Error

func (err *Error) Error() string

Error implements the error interface.

type NamedArgs

type NamedArgs map[string]interface{}

NamedArgs is a name/value map of arguments passed to a prepared statement that uses ?NNN, :AAA, @AAA, and/or $AAA parameter formats. Name matching is case-sensitive and the prefix character (one of [?:@$]) must be included in the name. Names that are missing from the map are treated as NULL. Names that are not used in the prepared statement are ignored.

It is not possible to mix named and anonymous ("?") parameters in the same statement. https://www.sqlite.org/lang_expr.html#varparam

type OpType added in v0.4.0

type OpType int

type RawBytes

type RawBytes []byte

RawBytes is a special string type that may be used for database input and output without the cost of an extra copy operation.

When used as an argument to a statement, the contents are bound using SQLITE_STATIC instead of SQLITE_TRANSIENT flag. This requires the contents to remain valid and unmodified until the end of statement execution. In particular, the caller must keep a reference to the value to prevent it from being garbage collected.

When used for retrieving query output, the internal []byte pointer is set to reference memory belonging to SQLite. The memory remains valid until another method is called on the Stmt object and should not be modified.

func (RawBytes) Copy

func (b RawBytes) Copy() []byte

Copy returns a Go-managed copy of b.

type RawString

type RawString string

RawString is a special string type that may be used for database input and output without the cost of an extra copy operation.

When used as an argument to a statement, the contents are bound using SQLITE_STATIC instead of SQLITE_TRANSIENT flag. This requires the contents to remain valid and unmodified until the end of statement execution. In particular, the caller must keep a reference to the value to prevent it from being garbage collected.

When used for retrieving query output, the internal string pointer is set to reference memory belonging to SQLite. The memory remains valid until another method is called on the Stmt object and should not be modified.

func (RawString) Copy

func (s RawString) Copy() string

Copy returns a Go-managed copy of s.

type RollbackFunc added in v0.4.0

type RollbackFunc func()

RollbackFunc is a callback function invoked by SQLite when a transaction is rolled back.

type Session added in v0.4.0

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) Attach added in v0.4.0

func (s *Session) Attach(tab string) error

Attach attaches a table to a session object. If the argument tab is equal to "", then changes are recorded for all tables in the database. https://www.sqlite.org/session/sqlite3session_attach.html

func (*Session) Changeset added in v0.4.0

func (s *Session) Changeset(w io.Writer) error

func (*Session) Close added in v0.4.0

func (s *Session) Close()

Close closes a session object previously created with CreateSession. https://www.sqlite.org/session/sqlite3session_delete.html

func (*Session) Diff added in v0.4.0

func (s *Session) Diff(fromDB, tbl string) error

func (*Session) Disable added in v0.4.0

func (s *Session) Disable()

Disable disables recording of changes by a Session. https://www.sqlite.org/session/sqlite3session_enable.html

func (*Session) Enable added in v0.4.0

func (s *Session) Enable()

Enable enables recording of changes by a Session. New Sessions start enabled. https://www.sqlite.org/session/sqlite3session_enable.html

func (*Session) IsEmpty added in v0.4.0

func (s *Session) IsEmpty() bool

https://sqlite.org/session/sqlite3session_isempty.html

func (*Session) IsEnabled added in v0.4.0

func (s *Session) IsEnabled() bool

IsEnabled queries if the session is currently enabled. https://www.sqlite.org/session/sqlite3session_enable.html

func (*Session) IsIndirect added in v0.4.0

func (s *Session) IsIndirect() bool

https://sqlite.org/session/sqlite3session_indirect.html

func (*Session) Patchset added in v0.4.0

func (s *Session) Patchset(w io.Writer) error

https://www.sqlite.org/session/sqlite3session_patchset.html

func (*Session) SetIndirect added in v0.4.0

func (s *Session) SetIndirect(indirect bool)

https://sqlite.org/session/sqlite3session_indirect.html

type Stmt

type Stmt struct {
	Tail string
	// contains filtered or unexported fields
}

Stmt is a prepared statement handle. https://www.sqlite.org/c3ref/stmt.html

func (*Stmt) Bind

func (s *Stmt) Bind(args ...interface{}) error

Bind binds either the named arguments or unnamed arguments depending on the type of arguments passed

func (*Stmt) BindParameterCount

func (s *Stmt) BindParameterCount() int

BindParameterCount returns the number of SQL parameters in the prepared statement. https://www.sqlite.org/c3ref/bind_parameter_count.html

func (*Stmt) Busy

func (s *Stmt) Busy() bool

Busy returns true if the prepared statement is in the middle of execution with a row available for scanning.

func (*Stmt) ClearBindings

func (s *Stmt) ClearBindings() error

ClearBindings clears the bindings on a prepared statement. Reset does not clear bindings. https://www.sqlite.org/c3ref/clear_bindings.html

func (*Stmt) Close

func (s *Stmt) Close() error

Close releases all resources associated with the prepared statement. This method can be called at any point in the statement's life cycle. https://www.sqlite.org/c3ref/finalize.html

func (*Stmt) ColumnBlob added in v0.1.2

func (s *Stmt) ColumnBlob(i int) (val []byte, err error)

ColumnBlob gets the blob value of column i (starting at 0). If the blob is NULL, then nil is returned. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnBytes added in v0.1.2

func (s *Stmt) ColumnBytes(i int) (int, error)

ColumnBytes gets the size of a blob or UTF-8 text in column i (starting at 0). https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnCount

func (s *Stmt) ColumnCount() int

ColumnCount returns the number of columns produced by the prepared statement. https://www.sqlite.org/c3ref/column_count.html

func (*Stmt) ColumnDouble added in v0.1.2

func (s *Stmt) ColumnDouble(i int) (val float64, ok bool, err error)

ColumnDouble gets the double value of column i (starting at 0). If the value is NULL, then val is set to 0.0 and ok is set to false. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnInt added in v0.1.2

func (s *Stmt) ColumnInt(i int) (val int, ok bool, err error)

ColumnInt gets the int value of column i (starting at 0). If the value is NULL, then val is set to 0 and ok is set to false. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnInt64 added in v0.1.2

func (s *Stmt) ColumnInt64(i int) (val int64, ok bool, err error)

ColumnInt64 gets the int64 value of column i (starting at 0). If the value is NULL, then val is set to 0 and ok is set to false. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnName

func (s *Stmt) ColumnName(i int) string

ColumnName returns the name of column produced by the prepared statement. The leftmost column is number 0. https://www.sqlite.org/c3ref/column_name.html

func (*Stmt) ColumnNames

func (s *Stmt) ColumnNames() []string

ColumnNames returns the names of columns produced by the prepared statement. https://www.sqlite.org/c3ref/column_name.html

func (*Stmt) ColumnRawBytes added in v0.1.2

func (s *Stmt) ColumnRawBytes(i int) (val RawBytes, err error)

ColumnRawBytes gets the blob value of column i (starting at 0). CAUTION: The internal []byte pointer is set to reference memory belonging to SQLite. The memory remains valid until another method is called on the Stmt object and should not be modified. This is similar to ColumnBlob, except faster and less safe. Consider using ColumnBlob unless performance is critical. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnRawString added in v0.1.2

func (s *Stmt) ColumnRawString(i int) (val RawString, ok bool, err error)

ColumnRawString gets the text value of column i (starting at 0). CAUTION: The internal string pointer is set to reference memory belonging to SQLite. The memory remains valid until another method is called on the Stmt object and should not be modified. This is similar to ColumnText, except faster and less safe. Consider using ColumnText unless performance is critical. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnText added in v0.1.2

func (s *Stmt) ColumnText(i int) (val string, ok bool, err error)

ColumnText gets the text value of column i (starting at 0). If the value is NULL, then val is set to "" and ok is set to false. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnType

func (s *Stmt) ColumnType(i int) byte

ColumnType returns the data type code of column i in the current row (one of INTEGER, FLOAT, TEXT, BLOB, or NULL). Unlike SQLite, these values are still defined even after type conversion. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) ColumnTypes

func (s *Stmt) ColumnTypes() []byte

ColumnTypes returns the data type codes of columns in the current row. Possible data types are INTEGER, FLOAT, TEXT, BLOB, and NULL. These represent the actual storage classes used by SQLite to store each value. Unlike SQLite, these values are still defined after type conversion. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) DeclType

func (s *Stmt) DeclType(i int) string

DeclType returns the type declaration of columns produced by the prepared statement. The leftmost column is number 0. https://www.sqlite.org/c3ref/column_decltype.html

func (*Stmt) DeclTypes

func (s *Stmt) DeclTypes() []string

DeclTypes returns the type declarations of columns produced by the prepared statement. https://www.sqlite.org/c3ref/column_decltype.html

func (*Stmt) Exec

func (s *Stmt) Exec(args ...interface{}) error

Exec is a convenience method that binds the given arguments to the statement then steps the statement to completion and resets the prepared statement. No rows are returned. Reset is always called, even in error cases. Note that bindings are not cleared.

func (*Stmt) ReadOnly

func (s *Stmt) ReadOnly() bool

ReadOnly returns true if the prepared statement makes no direct changes to the content of the database file. https://www.sqlite.org/c3ref/stmt_readonly.html

func (*Stmt) Reset

func (s *Stmt) Reset() error

Reset returns the prepared statement to its initial state, ready to be re-executed. This should be done when the remaining rows returned by a query are not needed, which releases some resources that would otherwise persist until the next call to Exec or Query. https://www.sqlite.org/c3ref/reset.html

func (*Stmt) Scan

func (s *Stmt) Scan(dst ...interface{}) error

Scan retrieves data from the current row, storing successive column values into successive arguments. The same row may be scanned multiple times. Nil arguments are silently skipped. https://www.sqlite.org/c3ref/column_blob.html

func (*Stmt) Status

func (s *Stmt) Status(op int, reset bool) int

Status returns the current value of a statement performance counter, specified by one of the STMTSTATUS constants. If reset is true, the value is reset back down to 0 after retrieval. https://www.sqlite.org/c3ref/stmt_status.html

func (*Stmt) Step

func (s *Stmt) Step() (bool, error)

Step evaluates the next step in the statement's program. It returns true if if a new row of data is ready for processing. https://www.sqlite.org/c3ref/step.html

func (*Stmt) StepToCompletion

func (s *Stmt) StepToCompletion() error

StepToCompletion is a convenience method that repeatedly calls Step until no more rows are returned or an error occurs. https://www.sqlite.org/c3ref/step.html

type UpdateFunc added in v0.4.0

type UpdateFunc func(op int, db, tbl RawString, row int64)

UpdateFunc is a callback function invoked by SQLite when a row is updated, inserted, or deleted.

type Value added in v0.4.0

type Value struct {
	// contains filtered or unexported fields
}

type ZeroBlob

type ZeroBlob int

ZeroBlob is a special argument type used to allocate a zero-filled BLOB of the specified length. The BLOB can then be opened for incremental I/O to efficiently transfer a large amount of data. The maximum BLOB size can be queried with Conn.Limit(LIMIT_LENGTH, -1).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL