db

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDatabase

func InitDatabase(db *sql.DB, params StateInitParams) error

func IsConflict

func IsConflict(err error) bool

func IsNull

func IsNull(err error) bool

func Open

func Open(dburl string) (*sql.DB, error)

func TransformBatchRow

func TransformBatchRow[T any, R any, PtrT BatchRowTransformable[T, R]](row R) T

func TransformRow

func TransformRow[T any, R any, PtrT RowTransformable[T, R]](row R) T

Types

type BatchRowTransformable

type BatchRowTransformable[T any, R any] interface {
	*T
	FromBatchRow(row R)
}

type MigrationState

type MigrationState struct {
	Version uint
	Dirty   bool
	Updated bool
}

func Migrate

func Migrate(db *sql.DB) (*MigrationState, error)

type RowTransformable

type RowTransformable[T any, R any] interface {
	*T
	FromRow(row R)
}

type StateInitParams

type StateInitParams struct {
	RootUserName     string
	RootUserPassword string
	RestRootPassword bool
}

type TxWrapper

type TxWrapper struct {
	db_gen.Queries
	// contains filtered or unexported fields
}

func (*TxWrapper) Commit

func (tx *TxWrapper) Commit() error

func (*TxWrapper) Rollback

func (tx *TxWrapper) Rollback() error

type Wrapper

type Wrapper struct {
	db_gen.Queries
	// contains filtered or unexported fields
}

func NewWrapper

func NewWrapper(db *sql.DB) *Wrapper

func (*Wrapper) BeginTx

func (db *Wrapper) BeginTx(ctx context.Context) (*TxWrapper, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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