driversqlite

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(serviceName string) (store.Driver, error)

New creates a new SQlite database on disk and a driver instance wrapping it.

Types

type ReadTx

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

ReadTx is a read-only transaction

func (*ReadTx) Get

func (r *ReadTx) Get(out any, query string, args ...any) error

Get runs a query to select one row and read it into out

func (*ReadTx) Select

func (r *ReadTx) Select(out []any, query string, args ...any) error

type ReadWriteTx

type ReadWriteTx struct {
	ReadTx
}

ReadWriteTx is a read-write transaction

func (*ReadWriteTx) Delete

func (rw *ReadWriteTx) Delete(query string, args ...any) error

func (*ReadWriteTx) Exec

func (rw *ReadWriteTx) Exec(query string, args ...any) (int64, error)

Exec runs the provided query with the provided args and returns the insert ID, if any

type Sqlite

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

Sqlite is a SQLite driver for libsdk store

func (*Sqlite) Exec

func (s *Sqlite) Exec(rec store.TxRecord, handler store.TxHandler) (store.Tx, any, error)

Exec executes a replayed transaction and returns its results

func (*Sqlite) Migrate

func (s *Sqlite) Migrate(statements []string) error

Migrate runs a migration statement that must succeed or an error is returned

type Tx

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

func (*Tx) DidWrite

func (t *Tx) DidWrite() bool

DidWrite returns true if the transaction was used to write

func (*Tx) Read

func (t *Tx) Read() store.ReadTx

Read returns a read-only transaction

func (*Tx) ReadWrite

func (t *Tx) ReadWrite() store.ReadWriteTx

ReadWrite returns a read-write transaction

Jump to

Keyboard shortcuts

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