sql3

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Pragma is a set of default commands used to modify the operation of the SQLite.
	//
	// 	- JOURNAL MODE = WAL
	// 	- BUSY TIMEOUT = 5000
	// 	- SYNCHRONOUS = NORMAL
	// 	- CACHE SIZE = 1000000000
	// 	- FOREIGN KEYS = TRUE
	// 	- TXLOCK = IMMEDIATE
	// 	- TEMP STORE = MEMORY
	// 	- MMAP SIZE = 3000000000
	PRAGMA = "" /* 156-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB

func Open

func Open(filename string) (*DB, error)

Open a new DB connection.

func Up

func Up(ctx context.Context, filename string, fsys fs.FS) (*DB, error)

Up from the current version.

func (*DB) Close

func (db *DB) Close() error

Close closes the database and prevents new queries from starting.

func (*DB) DoTx

func (db *DB) DoTx(ctx context.Context, f func(context.Context, *Tx) error) error

DoTx begins a transaction.

FIXME issue with transaction already been committed

func (*DB) Exec

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

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

func (*DB) Query

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

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.

func (*DB) QueryRow

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

QueryRow executes a query that is expected to return at most one row.

func (*DB) Tx

func (db *DB) Tx(ctx context.Context) (*Tx, error)

Tx

type FS

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

FS

func NewFS

func NewFS(fsys fs.FS, dir string) (*FS, error)

NewFS returns a FS

func (*FS) Up

func (fs *FS) Up(ctx context.Context, filename string) (*DB, error)

Up from the current version.

type Tx

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

Tx

func (*Tx) Commit

func (tx *Tx) Commit() error

Commit the transaction.

func (*Tx) Exec

func (tx *Tx) Exec(query string, args ...any) (sql.Result, error)

Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.

func (*Tx) Query

func (tx *Tx) Query(query string, args ...any) (*sql.Rows, error)

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query.

func (*Tx) QueryRow

func (tx *Tx) QueryRow(query string, args ...any) *sql.Row

QueryRow executes a query that is expected to return at most one row.

func (*Tx) Rollback

func (tx *Tx) Rollback() error

Rollback the transaction.

Jump to

Keyboard shortcuts

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