part

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 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, createF func() T) (*[]T, error)

func IsFin

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

func SimpleQ added in v0.25.2

func SimpleQ[T any](canTx CanTx, query string, ptr *T) (*[]T, error)

Types

type AfterEF added in v0.25.2

type AfterEF[T any] func(dataP *T, result sql.Result, txE error) (dataPR *T, stopErr error)

type AfterQF added in v0.25.2

type AfterQF[T any] func(dataP *T, rows *sql.Rows, txE error) (dataPR *T, stopErr error)

type BeforeF added in v0.25.2

type BeforeF[T any] func(dataP *T, sqlf *SqlFunc[T], txE error) (dataPR *T, stopErr 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) *SqlTx[T]

func (*SqlTx[T]) Fin

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

Jump to

Keyboard shortcuts

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