database

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec added in v0.11.3

func Exec(ctx context.Context, db DB, query string, args []interface{}) (sql.Result, error)

func GetTable

func GetTable(m any) string

func GetTableSingular

func GetTableSingular(m any) string

func Value added in v0.14.0

func Value[T any](txFunc Transaction, cb func(tx *sqlx.Tx) (T, error)) (T, error)

Types

type Config added in v0.16.0

type Config interface {
	DriverName() string
	DataSourceName() string
	SetDialect()
}

type DB added in v0.7.1

type DB interface {
	sqlx.QueryerContext
	sqlx.ExecerContext
}

type DBConfiger added in v0.16.0

type DBConfiger interface {
	DBConfig() Config
}

type Read added in v0.10.2

type Read func(func(tx *sqlx.Tx) error) error

func NewRead added in v0.11.3

func NewRead(ctx context.Context, mtx sync.Locker, db DB) Read

func (Read) Run added in v0.14.0

func (f Read) Run(cb func(tx *sqlx.Tx) error) error

type Tabler

type Tabler interface {
	Table() string
}

type Transaction added in v0.14.0

type Transaction interface {
	Run(func(tx *sqlx.Tx) error) error
}

type Update added in v0.10.2

type Update func(func(tx *sqlx.Tx) error) error

func NewUpdate added in v0.11.3

func NewUpdate(ctx context.Context, mtx sync.Locker, db DB) Update

func (Update) Run added in v0.14.0

func (f Update) Run(cb func(tx *sqlx.Tx) error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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