util

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK = 0 /* Successful result */

	ERROR      = 1  /* Generic error */
	INTERNAL   = 2  /* Internal logic error in SQLite */
	PERM       = 3  /* Access permission denied */
	ABORT      = 4  /* Callback routine requested an abort */
	BUSY       = 5  /* The database file is locked */
	LOCKED     = 6  /* A table in the database is locked */
	NOMEM      = 7  /* A malloc() failed */
	READONLY   = 8  /* Attempt to write a readonly database */
	INTERRUPT  = 9  /* Operation terminated by sqlite3_interrupt() */
	IOERR      = 10 /* Some kind of disk I/O error occurred */
	CORRUPT    = 11 /* The database disk image is malformed */
	NOTFOUND   = 12 /* Unknown opcode in sqlite3_file_control() */
	FULL       = 13 /* Insertion failed because database is full */
	CANTOPEN   = 14 /* Unable to open the database file */
	PROTOCOL   = 15 /* Database lock protocol error */
	EMPTY      = 16 /* Internal use only */
	SCHEMA     = 17 /* The database schema changed */
	TOOBIG     = 18 /* String or BLOB exceeds size limit */
	CONSTRAINT = 19 /* Abort due to constraint violation */
	MISMATCH   = 20 /* Data type mismatch */
	MISUSE     = 21 /* Library used incorrectly */
	NOLFS      = 22 /* Uses OS features not supported on host */
	AUTH       = 23 /* Authorization denied */
	FORMAT     = 24 /* Not used */
	RANGE      = 25 /* 2nd parameter to sqlite3_bind out of range */
	NOTADB     = 26 /* File opened that is not a database file */
	NOTICE     = 27 /* Notifications from sqlite3_log() */
	WARNING    = 28 /* Warnings from sqlite3_log() */

	ROW  = 100 /* sqlite3_step() has another row ready */
	DONE = 101 /* sqlite3_step() has finished executing */

	ERROR_MISSING_COLLSEQ   = ERROR | (1 << 8)
	ERROR_RETRY             = ERROR | (2 << 8)
	ERROR_SNAPSHOT          = ERROR | (3 << 8)
	IOERR_READ              = IOERR | (1 << 8)
	IOERR_SHORT_READ        = IOERR | (2 << 8)
	IOERR_WRITE             = IOERR | (3 << 8)
	IOERR_FSYNC             = IOERR | (4 << 8)
	IOERR_DIR_FSYNC         = IOERR | (5 << 8)
	IOERR_TRUNCATE          = IOERR | (6 << 8)
	IOERR_FSTAT             = IOERR | (7 << 8)
	IOERR_UNLOCK            = IOERR | (8 << 8)
	IOERR_RDLOCK            = IOERR | (9 << 8)
	IOERR_DELETE            = IOERR | (10 << 8)
	IOERR_BLOCKED           = IOERR | (11 << 8)
	IOERR_NOMEM             = IOERR | (12 << 8)
	IOERR_ACCESS            = IOERR | (13 << 8)
	IOERR_CHECKRESERVEDLOCK = IOERR | (14 << 8)
	IOERR_LOCK              = IOERR | (15 << 8)
	IOERR_CLOSE             = IOERR | (16 << 8)
	IOERR_DIR_CLOSE         = IOERR | (17 << 8)
	IOERR_SHMOPEN           = IOERR | (18 << 8)
	IOERR_SHMSIZE           = IOERR | (19 << 8)
	IOERR_SHMLOCK           = IOERR | (20 << 8)
	IOERR_SHMMAP            = IOERR | (21 << 8)
	IOERR_SEEK              = IOERR | (22 << 8)
	IOERR_DELETE_NOENT      = IOERR | (23 << 8)
	IOERR_MMAP              = IOERR | (24 << 8)
	IOERR_GETTEMPPATH       = IOERR | (25 << 8)
	IOERR_CONVPATH          = IOERR | (26 << 8)
	IOERR_VNODE             = IOERR | (27 << 8)
	IOERR_AUTH              = IOERR | (28 << 8)
	IOERR_BEGIN_ATOMIC      = IOERR | (29 << 8)
	IOERR_COMMIT_ATOMIC     = IOERR | (30 << 8)
	IOERR_ROLLBACK_ATOMIC   = IOERR | (31 << 8)
	IOERR_DATA              = IOERR | (32 << 8)
	IOERR_CORRUPTFS         = IOERR | (33 << 8)
	IOERR_IN_PAGE           = IOERR | (34 << 8)
	LOCKED_SHAREDCACHE      = LOCKED | (1 << 8)
	LOCKED_VTAB             = LOCKED | (2 << 8)
	BUSY_RECOVERY           = BUSY | (1 << 8)
	BUSY_SNAPSHOT           = BUSY | (2 << 8)
	BUSY_TIMEOUT            = BUSY | (3 << 8)
	CANTOPEN_NOTEMPDIR      = CANTOPEN | (1 << 8)
	CANTOPEN_ISDIR          = CANTOPEN | (2 << 8)
	CANTOPEN_FULLPATH       = CANTOPEN | (3 << 8)
	CANTOPEN_CONVPATH       = CANTOPEN | (4 << 8)
	CANTOPEN_DIRTYWAL       = CANTOPEN | (5 << 8) /* Not Used */
	CANTOPEN_SYMLINK        = CANTOPEN | (6 << 8)
	CORRUPT_VTAB            = CORRUPT | (1 << 8)
	CORRUPT_SEQUENCE        = CORRUPT | (2 << 8)
	CORRUPT_INDEX           = CORRUPT | (3 << 8)
	READONLY_RECOVERY       = READONLY | (1 << 8)
	READONLY_CANTLOCK       = READONLY | (2 << 8)
	READONLY_ROLLBACK       = READONLY | (3 << 8)
	READONLY_DBMOVED        = READONLY | (4 << 8)
	READONLY_CANTINIT       = READONLY | (5 << 8)
	READONLY_DIRECTORY      = READONLY | (6 << 8)
	ABORT_ROLLBACK          = ABORT | (2 << 8)
	CONSTRAINT_CHECK        = CONSTRAINT | (1 << 8)
	CONSTRAINT_COMMITHOOK   = CONSTRAINT | (2 << 8)
	CONSTRAINT_FOREIGNKEY   = CONSTRAINT | (3 << 8)
	CONSTRAINT_FUNCTION     = CONSTRAINT | (4 << 8)
	CONSTRAINT_NOTNULL      = CONSTRAINT | (5 << 8)
	CONSTRAINT_PRIMARYKEY   = CONSTRAINT | (6 << 8)
	CONSTRAINT_TRIGGER      = CONSTRAINT | (7 << 8)
	CONSTRAINT_UNIQUE       = CONSTRAINT | (8 << 8)
	CONSTRAINT_VTAB         = CONSTRAINT | (9 << 8)
	CONSTRAINT_ROWID        = CONSTRAINT | (10 << 8)
	CONSTRAINT_PINNED       = CONSTRAINT | (11 << 8)
	CONSTRAINT_DATATYPE     = CONSTRAINT | (12 << 8)
	NOTICE_RECOVER_WAL      = NOTICE | (1 << 8)
	NOTICE_RECOVER_ROLLBACK = NOTICE | (2 << 8)
	NOTICE_RBU              = NOTICE | (3 << 8)
	WARNING_AUTOINDEX       = WARNING | (1 << 8)
	AUTH_USER               = AUTH | (1 << 8)

	OK_LOAD_PERMANENTLY = OK | (1 << 8)
	OK_SYMLINK          = OK | (2 << 8) /* internal use only */
)

https://sqlite.com/rescode.html

View Source
const (
	NilErr       = ErrorString("sqlite3: invalid memory address or null pointer dereference")
	OOMErr       = ErrorString("sqlite3: out of memory")
	RangeErr     = ErrorString("sqlite3: index out of range")
	NoNulErr     = ErrorString("sqlite3: missing NUL terminator")
	NoBinaryErr  = ErrorString("sqlite3: no SQLite binary embed/set/loaded")
	BadBinaryErr = ErrorString("sqlite3: invalid SQLite binary embed/set/loaded")
	TimeErr      = ErrorString("sqlite3: invalid time value")
	WhenceErr    = ErrorString("sqlite3: invalid whence")
	OffsetErr    = ErrorString("sqlite3: invalid offset")
	TailErr      = ErrorString("sqlite3: multiple statements")
	IsolationErr = ErrorString("sqlite3: unsupported isolation level")
	ValueErr     = ErrorString("sqlite3: unsupported value")
	NoVFSErr     = ErrorString("sqlite3: no such vfs: ")
)
View Source
const (
	PtrLen = 4
	IntLen = 4
)

Variables

This section is empty.

Functions

func AppendNumber added in v0.23.0

func AppendNumber(dst []byte, f float64) []byte

func CompilerSupported added in v0.22.0

func CompilerSupported() bool

func DelHandle added in v0.8.2

func DelHandle(ctx context.Context, id Ptr_t) error

func ErrorCodeString added in v0.6.0

func ErrorCodeString(rc uint32) string

func ExportFuncII added in v0.6.0

func ExportFuncII[TR, T0 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0) TR)

func ExportFuncIII added in v0.6.0

func ExportFuncIII[TR, T0, T1 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1) TR)

func ExportFuncIIII added in v0.6.0

func ExportFuncIIII[TR, T0, T1, T2 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2) TR)

func ExportFuncIIIII added in v0.6.0

func ExportFuncIIIII[TR, T0, T1, T2, T3 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3) TR)

func ExportFuncIIIIII added in v0.6.0

func ExportFuncIIIIII[TR, T0, T1, T2, T3, T4 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3, T4) TR)

func ExportFuncIIIIIII added in v0.12.1

func ExportFuncIIIIIII[TR, T0, T1, T2, T3, T4, T5 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3, T4, T5) TR)

func ExportFuncIIIIJ added in v0.6.0

func ExportFuncIIIIJ[TR, T0, T1, T2 i32, T3 i64](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3) TR)

func ExportFuncIIJ added in v0.6.0

func ExportFuncIIJ[TR, T0 i32, T1 i64](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1) TR)

func ExportFuncVI added in v0.8.2

func ExportFuncVI[T0 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0))

func ExportFuncVII added in v0.12.0

func ExportFuncVII[T0, T1 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1))

func ExportFuncVIII added in v0.8.2

func ExportFuncVIII[T0, T1, T2 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2))

func ExportFuncVIIII added in v0.12.0

func ExportFuncVIIII[T0, T1, T2, T3 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3))

func ExportFuncVIIIII added in v0.12.0

func ExportFuncVIIIII[T0, T1, T2, T3, T4 i32](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3, T4))

func ExportFuncVIIIIJ added in v0.12.1

func ExportFuncVIIIIJ[T0, T1, T2, T3 i32, T4 i64](mod wazero.HostModuleBuilder, name string, fn func(context.Context, api.Module, T0, T1, T2, T3, T4))

func GCD added in v0.20.0

func GCD(m, n int) int

func GetHandle added in v0.8.2

func GetHandle(ctx context.Context, id Ptr_t) any

func LCM added in v0.20.0

func LCM(m, n int) int

func Lerp added in v0.20.0

func Lerp(v0, v1, t float64) float64

https://developer.nvidia.com/blog/lerp-faster-cuda/

func NewContext added in v0.8.2

func NewContext(ctx context.Context) context.Context

func Read added in v0.23.0

func Read[T i8](mod api.Module, ptr Ptr_t) T

func Read32 added in v0.23.0

func Read32[T i32](mod api.Module, ptr Ptr_t) T

func Read64 added in v0.23.0

func Read64[T i64](mod api.Module, ptr Ptr_t) T

func ReadFloat64

func ReadFloat64(mod api.Module, ptr Ptr_t) float64

func ReadString

func ReadString(mod api.Module, ptr Ptr_t, maxlen int64) string

func ReflectType added in v0.12.0

func ReflectType(v reflect.Value) reflect.Type

func UnwrapPointer added in v0.12.0

func UnwrapPointer(p PointerUnwrap) any

func View

func View(mod api.Module, ptr Ptr_t, size int64) []byte

func Write added in v0.23.0

func Write[T i8](mod api.Module, ptr Ptr_t, v T)

func Write32 added in v0.23.0

func Write32[T i32](mod api.Module, ptr Ptr_t, v T)

func Write64 added in v0.23.0

func Write64[T i64](mod api.Module, ptr Ptr_t, v T)

func WriteBytes

func WriteBytes(mod api.Module, ptr Ptr_t, b []byte)

func WriteFloat64

func WriteFloat64(mod api.Module, ptr Ptr_t, v float64)

func WriteString

func WriteString(mod api.Module, ptr Ptr_t, s string)

Types

type ConnKey added in v0.22.0

type ConnKey struct{}

type ErrorJoiner added in v0.17.1

type ErrorJoiner []error

func (*ErrorJoiner) Join added in v0.17.1

func (j *ErrorJoiner) Join(errs ...error)

type ErrorString

type ErrorString string

func AssertErr

func AssertErr() ErrorString

func (ErrorString) Error

func (e ErrorString) Error() string

type JSON added in v0.12.0

type JSON struct{ Value any }

func (JSON) Scan added in v0.12.0

func (j JSON) Scan(value any) error

type MappedRegion added in v0.14.0

type MappedRegion struct {
	Ptr Ptr_t
	// contains filtered or unexported fields
}

func MapRegion added in v0.14.0

func MapRegion(ctx context.Context, mod api.Module, f *os.File, offset int64, size int32, readOnly bool) (*MappedRegion, error)

func (*MappedRegion) Unmap added in v0.14.0

func (r *MappedRegion) Unmap() error

type Pointer added in v0.12.0

type Pointer[T any] struct{ Value T }

type PointerUnwrap added in v0.12.0

type PointerUnwrap interface {
	// contains filtered or unexported methods
}

type Ptr_t added in v0.23.0

type Ptr_t uint32

func AddHandle added in v0.8.2

func AddHandle(ctx context.Context, a any) Ptr_t

type Res_t added in v0.23.0

type Res_t int32

type Set added in v0.18.4

type Set[E comparable] map[E]struct{}

func (Set[E]) Add added in v0.18.4

func (s Set[E]) Add(v E)

func (Set[E]) Contains added in v0.18.4

func (s Set[E]) Contains(v E) bool

type Stk_t added in v0.23.0

type Stk_t = uint64

Jump to

Keyboard shortcuts

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