dbutil

package
v0.0.0-...-a45bf93 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoTx

func DoTx(ctx context.Context, db *sqlx.DB, fn func(tx *sqlx.Tx) error) error

func DoTx1

func DoTx1[T any](ctx context.Context, db *sqlx.DB, fn func(tx *sqlx.Tx) (T, error)) (T, error)

func DoTx2

func DoTx2[A, B any](ctx context.Context, db *sqlx.DB, fn func(tx *sqlx.Tx) (A, B, error)) (A, B, error)

func List

func List[T any](ctx context.Context, db *sqlx.DB, query, primaryKey string, p ListParams[T]) ([]T, error)

func NewTestDB

func NewTestDB(t testing.TB) *sqlx.DB

func OpenDB

func OpenDB(dsn string) (*sqlx.DB, error)

Types

type ListParams

type ListParams[T any] struct {
	Span state.Span[T]

	MaxLimit     int
	DefaultLimit int
	Limit        int
}

Jump to

Keyboard shortcuts

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