sqlite

package
v0.0.0-...-72e33f6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONSTRAINT_CHECK      = 275
	CONSTRAINT_COMMITHOOK = 531
	CONSTRAINT_DATATYPE   = 3091
	CONSTRAINT_FOREIGNKEY = 787
	CONSTRAINT_FUNCTION   = 1043
	CONSTRAINT_NOTNULL    = 1299
	CONSTRAINT_PINNED     = 2835
	CONSTRAINT_PRIMARYKEY = 1555
	CONSTRAINT_ROWID      = 2579
	CONSTRAINT_TRIGGER    = 1811
	CONSTRAINT_UNIQUE     = 2067
	CONSTRAINT_VTAB       = 2323
)

Variables

This section is empty.

Functions

func BeginTx

func BeginTx(ctx context.Context, db *sql.DB, write bool) (*sql.Tx, error)

func Migrate

func Migrate(sqlDB *sql.DB) error

func New

func New(dbPath string) (*sql.DB, error)

Types

type ConstraintError

type ConstraintError Error

func AsConstraintError

func AsConstraintError(err error, code int, codes ...int) (ConstraintError, bool)

func (ConstraintError) IsField

func (e ConstraintError) IsField(field string) bool

type DB

type DB struct {
	*sql.DB
}

func NewDB

func NewDB(db *sql.DB) DB

func (DB) BeginTx

func (db DB) BeginTx(ctx context.Context, write bool) (Tx, error)

func (DB) C

func (db DB) C() DBTx

func (DB) ExecContext

func (db DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (DB) PrepareContext

func (db DB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)

func (DB) QueryContext

func (db DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (DB) QueryRowContext

func (db DB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

type DBTx

type DBTx struct {
	repo.DBTX
	*repo.Queries
}

type Error

type Error struct {
	Code int
	Msg  string
}

func AsError

func AsError(err error) (Error, bool)

type Tx

type Tx struct {
	*sql.Tx
	// contains filtered or unexported fields
}

func (Tx) C

func (tx Tx) C() DBTx

func (Tx) Commit

func (tx Tx) Commit() error

func (Tx) CommitHook

func (tx Tx) CommitHook(fn func())

func (Tx) ExecContext

func (tx Tx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (Tx) PrepareContext

func (tx Tx) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)

func (Tx) QueryContext

func (tx Tx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

func (Tx) QueryRowContext

func (tx Tx) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row

func (Tx) Rollback

func (tx Tx) Rollback() error

Jump to

Keyboard shortcuts

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