part

package
v0.28.20240128084401 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Execf
	Queryf
)

Variables

This section is empty.

Functions

func DealRows

func DealRows[T any](rows *sql.Rows, newT func() T) ([]T, error)

func IsFin

func IsFin[T any](t *SqlTx[T]) bool

Types

type AfterEF added in v0.25.2

type AfterEF[T any] func(ctxVP *T, result sql.Result, e *error)

type AfterQF added in v0.25.2

type AfterQF[T any] func(ctxVP *T, rows *sql.Rows, e *error)

type BeforeF added in v0.25.2

type BeforeF[T any] func(ctxVP *T, sqlf *SqlFunc[T], e *error)

type CanTx

type CanTx interface {
	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

type SqlFunc

type SqlFunc[T any] struct {
	Ty         int
	Ctx        context.Context
	Query      string
	Args       []any
	SkipSqlErr bool
	// contains filtered or unexported fields
}

type SqlTx

type SqlTx[T any] struct {
	// contains filtered or unexported fields
}

func BeginTx

func BeginTx[T any](canTx CanTx, ctx context.Context, opts ...*sql.TxOptions) *SqlTx[T]

func (*SqlTx[T]) AfterEF added in v0.25.2

func (t *SqlTx[T]) AfterEF(f AfterEF[T]) *SqlTx[T]

func (*SqlTx[T]) AfterQF added in v0.25.2

func (t *SqlTx[T]) AfterQF(f AfterQF[T]) *SqlTx[T]

func (*SqlTx[T]) BeforeF added in v0.25.2

func (t *SqlTx[T]) BeforeF(f BeforeF[T]) *SqlTx[T]

func (*SqlTx[T]) Do

func (t *SqlTx[T]) Do(sqlf SqlFunc[T]) *SqlTx[T]

func (*SqlTx[T]) DoPlaceHolder added in v0.25.2

func (t *SqlTx[T]) DoPlaceHolder(sqlf SqlFunc[T], ptr any, replaceF ...func(index int, holder string) (replaceTo string)) *SqlTx[T]

func (*SqlTx[T]) Fin

func (t *SqlTx[T]) Fin() (ctxVP T, e error)

func (*SqlTx[T]) SimpleDo added in v0.28.1

func (t *SqlTx[T]) SimpleDo(query string, args ...any) *SqlTx[T]

func (*SqlTx[T]) SimplePlaceHolderA added in v0.28.1

func (t *SqlTx[T]) SimplePlaceHolderA(query string, ptr any) *SqlTx[T]

PlaceHolder will replaced by ?

func (*SqlTx[T]) SimplePlaceHolderB added in v0.28.1

func (t *SqlTx[T]) SimplePlaceHolderB(query string, ptr any) *SqlTx[T]

PlaceHolder will replaced by $%d

Jump to

Keyboard shortcuts

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