dao

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ErrorClosingStatement = "Error closing the statement"
	ErrorClosingResultSet = "Error closing the result set"
)

Variables

This section is empty.

Functions

func CloseResultSet added in v0.5.0

func CloseResultSet(rows *sqlx.Rows)

func CloseStatement added in v0.5.0

func CloseStatement(statement *sqlx.NamedStmt)

func ErrContextFailed added in v0.5.0

func ErrContextFailed(errs ...error) error

func Exists added in v0.70.0

func Exists[T Entity](ctx context.Context, sqlStatement string, criteria *T) bool

func MutateContext added in v0.70.0

func MutateContext[T any](ctx context.Context, sqlStatement string, target *T, fn MutateFunction) error

func MutateOne added in v0.70.0

func MutateOne[T Entity](ctx context.Context, sqlStatement string, target *T) error

func QueryContext added in v0.70.0

func QueryContext(ctx context.Context, sqlStatement string, fn QueryFunction) error

func QueryMany added in v0.70.0

func QueryMany[T Entity](ctx context.Context, sqlStatement string, criteria *T) ([]T, error)

func QueryOne added in v0.70.0

func QueryOne[T Entity](ctx context.Context, sqlStatement string, criteria *T) (*T, error)

Types

type Entity added in v0.70.0

type Entity interface {
	any
}

type ExistsFn added in v0.70.0

type ExistsFn[T Entity] func(ctx context.Context, target *T) bool

type MutateFunction added in v0.70.0

type MutateFunction func(result sql.Result) error

type MutateOneFn added in v0.70.0

type MutateOneFn[T Entity] func(ctx context.Context, target *T) error

type QueryFunction added in v0.70.0

type QueryFunction func(statement *sqlx.NamedStmt) error

type QueryManyFn added in v0.70.0

type QueryManyFn[T Entity] func(ctx context.Context, target *T) ([]T, error)

type QueryOneFn added in v0.70.0

type QueryOneFn[T Entity] func(ctx context.Context, target *T) error

Jump to

Keyboard shortcuts

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