sqlite

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MPL-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const (
	TypeNull = sqlite.SQLITE_NULL

	OpenNoMutex     = sqlite.SQLITE_OPEN_NOMUTEX
	OpenReadOnly    = sqlite.SQLITE_OPEN_READONLY
	OpenURI         = sqlite.SQLITE_OPEN_URI
	OpenWAL         = sqlite.SQLITE_OPEN_WAL
	OpenCreate      = sqlite.SQLITE_OPEN_CREATE
	OpenReadWrite   = sqlite.SQLITE_OPEN_READWRITE
	OpenSharedCache = sqlite.SQLITE_OPEN_SHAREDCACHE
	OpenExclusive   = sqlite.SQLITE_OPEN_EXCLUSIVE

	ResultCodeInterrupt        = ResultCode(sqlite.SQLITE_INTERRUPT)
	ResultCodeBusy             = ResultCode(sqlite.SQLITE_BUSY)
	ResultCodeAbort            = ResultCode(sqlite.SQLITE_ABORT)
	ResultCodeConstraintUnique = ResultCode(sqlite.SQLITE_CONSTRAINT_UNIQUE)
	ResultCodeGenericError     = ResultCode(sqlite.SQLITE_ERROR)
	ResultCodeCantOpen         = ResultCode(sqlite.SQLITE_CANTOPEN)

	LimitLength = sqlite.SQLITE_LIMIT_LENGTH
)

Variables

View Source
var (
	ErrBlobClosed = sqlite.ErrBlobClosed
)
View Source
var ErrCode = sqlite.ErrCode

Deprecated. This may differ from GetResultCode in that it returns SQLITE_OK if there's no error, and SQLITE_ERROR if there's an error, but it can't extract a sqlite error code.

Functions

func IsPrimaryResultCodeErr

func IsPrimaryResultCodeErr(err error, code ResultCode) bool

func IsResultCode

func IsResultCode(err error, code ResultCode) bool

func StmtColumnOption

func StmtColumnOption[V any](stmt *Stmt, col int, get func(_ *Stmt, col int) V, opt *g.Option[V])

Types

type Blob

type Blob = sqlite.Blob

type ColIter

type ColIter int

func (ColIter) Get

func (me ColIter) Get() int

func (*ColIter) PostInc

func (me *ColIter) PostInc() int

type Conn

type Conn struct {
	// This can't be embedded because the underlying libraries probably won't support it.
	*sqlite.Conn
}

This is only used as a pointer type because the existing APIs expect *Conn.

func OpenConn

func OpenConn(path string, flags ...OpenFlags) (*Conn, error)

func (*Conn) CreateFunction

func (c *Conn) CreateFunction(name string, impl *FunctionImpl) error

type Context

type Context = sqlite.Context

type FunctionImpl

type FunctionImpl struct {
	NArgs         int
	Scalar        func(ctx Context, args []Value) (GoValue, error)
	Deterministic bool
}

type GoValue

type GoValue any

GoValue is a result value for application-defined functions. crawshaw provides the context result API, but zombiezen expects a hybrid value-type to be returned. GoValue calls out the Go part of this hybrid type explicitly.

func BlobValue

func BlobValue(b []byte) GoValue

type OpenFlags

type OpenFlags = sqlite.OpenFlags

type ResultCode

type ResultCode sqlite.ErrorCode

func GetResultCode

func GetResultCode(err error) (_ ResultCode, ok bool)

func (ResultCode) ToPrimary

func (me ResultCode) ToPrimary() ResultCode

type Stmt

type Stmt = sqlite.Stmt

type Value

type Value = sqlite.Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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