storage

package
v0.0.0-...-dc45d32 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoRows

func NoRows(err error) bool

Types

type DB

type DB[Queries any] struct {
	// contains filtered or unexported fields
}

func GetDB

func GetDB[Queries any](
	dbName string, migrations embed.FS, factory func(tx DBTX) *Queries) (*DB[Queries], error)

func TestDB

func TestDB[Queries any](migrations embed.FS, factory func(tx DBTX) *Queries) *DB[Queries]

func (*DB[Queries]) Close

func (db *DB[Queries]) Close() error

func (*DB[Queries]) RDBMS

func (db *DB[Queries]) RDBMS() *sql.DB

func (*DB[Queries]) Read

func (db *DB[Queries]) Read(ctx context.Context, f func(queries *Queries) error) error

func (*DB[Queries]) Write

func (db *DB[Queries]) Write(ctx context.Context, f func(queries *Queries) error) error

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...any) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...any) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...any) *sql.Row
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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