driversqlite

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 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 a single row and read it into out.

func (*ReadTx) Select

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

Select runs a query to select one or more rows and read them into out.

type ReadWriteTx

type ReadWriteTx struct {
	ReadTx
}

ReadWriteTx is a read-write transaction

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 Exec should be used for any insert, update, or delete queries.

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 migration statements that must all 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