db

package
v0.0.0-...-a2bdb02 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDropFailed = errors.New("failed to run database rollback")
View Source
var ErrMigrationFailed = errors.New("failed to run database migration")
View Source
var ErrRollbackFailed = errors.New("failed to run database rollback")

Functions

func Drop

func Drop(_ string) error

func DumpSchema

func DumpSchema(_ string) error

func Migrate

func Migrate(_ string) error

func MustConnectOnce

func MustConnectOnce()

func Rollback

func Rollback(_ string) error

func WalCleanup

func WalCleanup(_ string) error

Types

type DbWrapper

type DbWrapper struct {
	// contains filtered or unexported fields
}
var Db DbWrapper

func (DbWrapper) Close

func (db DbWrapper) Close() error

func (DbWrapper) ExecContext

func (db DbWrapper) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (DbWrapper) QueryContext

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

func (DbWrapper) QueryRowContext

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

func (DbWrapper) QueryRowxContext

func (db DbWrapper) QueryRowxContext(ctx context.Context, query string, args ...any) *sqlx.Row

func (DbWrapper) SelectContext

func (db DbWrapper) SelectContext(ctx context.Context, dest any, query string, args ...any) error

func (DbWrapper) Transaction

func (db DbWrapper) Transaction(ctx context.Context, fn func(tx *sqlx.Tx) error) error

Jump to

Keyboard shortcuts

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