sqlite

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 7 Imported by: 2

README

A Go SQLite driver.

Inspired by go-sqlite-lite.

Upgrading SQLite

Grab the "Alternative Source Code Formats" from https://www.sqlite.org/download.html, build and copy the sqlite3.c and sqlite3.h files to this repo:

wget https://www.sqlite.org/2022/sqlite-src-3390400.zip
unzip sqlite-src-3390400.zip 
cd sqlite-src-3390400
CFLAGS='-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1' ./configure
make sqlite3.c
cp sqlite3.c sqlite3.h PATH_TO_THIS_REPO/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRows = errors.New("no rows in result set")
)

Functions

func Terminate

func Terminate(sql string) string

Types

type Conn

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

func Memory

func Memory() (Conn, error)

func Open

func Open(name string, create bool) (Conn, error)

func (Conn) BusyTimeout

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

func (Conn) Changes

func (c Conn) Changes() int

func (*Conn) Close

func (c *Conn) Close() error

func (Conn) Exec

func (c Conn) Exec(sql string, args ...any) error

func (Conn) ExecB

func (c Conn) ExecB(sql []byte, args ...any) error

func (Conn) ExecTerminated

func (c Conn) ExecTerminated(sql []byte) error

func (Conn) LastInsertRowID

func (c Conn) LastInsertRowID() int

func (Conn) MustExec

func (c Conn) MustExec(sql string, args ...any)

func (Conn) Prepare

func (c Conn) Prepare(sql []byte, args ...any) (*Stmt, error)

func (Conn) Row

func (c Conn) Row(sql string, args ...any) Row

func (Conn) RowB

func (c Conn) RowB(sql []byte, args ...any) Row

func (Conn) Rows

func (c Conn) Rows(sql string, args ...any) Rows

func (Conn) RowsB

func (c Conn) RowsB(sql []byte, args ...any) Rows

func (Conn) Transaction

func (c Conn) Transaction(f func() error) error

type Error

type Error struct {
	Code    int
	Message string
}

func (Error) Error

func (err Error) Error() string

type Option

type Option[T any] struct {
	Value T
	Valid bool
}

type PrepareError

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

func (PrepareError) Error

func (err PrepareError) Error() string

func (PrepareError) Unwrap

func (e PrepareError) Unwrap() error

type RawBytes

type RawBytes []byte

When reading values into a RawByte, the slice is owned by sqlite and will only be valid until the next call on the statement is made.

type Row

type Row struct {
	Stmt *Stmt
	// contains filtered or unexported fields
}

func (Row) Map

func (r Row) Map() (map[string]any, error)

func (Row) MapInto

func (r Row) MapInto(m map[string]any) error

func (Row) Scan

func (r Row) Scan(dst ...interface{}) error

type Rows

type Rows struct {
	Stmt *Stmt
	// contains filtered or unexported fields
}

func (Rows) Close

func (r Rows) Close()

func (Rows) Error

func (r Rows) Error() error

func (*Rows) Next

func (r *Rows) Next() bool

func (*Rows) Scan

func (r *Rows) Scan(dst ...interface{}) error

type Scanner

type Scanner interface {
	Scan(dest ...any) error
}

type Stmt

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

func (*Stmt) Bind

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

func (*Stmt) ClearBindings

func (s *Stmt) ClearBindings() error

func (*Stmt) Close

func (s *Stmt) Close() error

func (*Stmt) ColumnBytes

func (s *Stmt) ColumnBytes(i int) ([]byte, error)

func (*Stmt) ColumnDouble

func (s *Stmt) ColumnDouble(i int) float64

func (*Stmt) ColumnInt

func (s *Stmt) ColumnInt(i int) int

func (*Stmt) ColumnInt64

func (s *Stmt) ColumnInt64(i int) int64

func (*Stmt) ColumnNames

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

func (*Stmt) ColumnRawBytes

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

func (*Stmt) ColumnText

func (s *Stmt) ColumnText(i int) (string, error)

func (*Stmt) ColumnTypes

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

func (*Stmt) Exec

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

func (*Stmt) Map

func (s *Stmt) Map() (map[string]any, error)

func (*Stmt) MapInto

func (s *Stmt) MapInto(m map[string]any) error

func (*Stmt) Reset

func (s *Stmt) Reset() error

func (*Stmt) Row

func (s *Stmt) Row(dst ...interface{}) (bool, error)

func (*Stmt) Scan

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

func (*Stmt) Step

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

func (*Stmt) StepToCompletion

func (s *Stmt) StepToCompletion() error

Jump to

Keyboard shortcuts

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