builder

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSQLQuery

func BuildSQLQuery(
	tableName string,
	filters *[]page.FilterCondition,
	sorts *[]page.SortOrder,
	limit int,
	offset int,
	asCount bool,
) (string, []any)

func ByID

func ByID[T any](
	ctx context.Context,
	table string,
	id int64,
	mapper func(res *sql.Row) (*T, error),
) (*T, error)

func Count

func Count(ctx context.Context, table string, filter *[]page.FilterCondition) (int, error)

func Eq

func Eq[T any](field string, value T) page.FilterCondition

func ExecuteSQLQuery

func ExecuteSQLQuery[T any](
	ctx context.Context,
	query string,
	mapper func(res *sql.Rows) (*T, error),
	args ...interface{},
) ([]*T, error)

func ExecuteSQLRow

func ExecuteSQLRow[T any](
	ctx context.Context,
	query string,
	mapper func(res *sql.Row) (*T, error),
	args ...interface{},
) (*T, error)

func GetDB

func GetDB() *sql.DB

func GetPagination

func GetPagination(p dto.PaginationQuery) *page.Pagination

func GetSortOrder

func GetSortOrder(sort dto.Sorting) *[]page.SortOrder

func Inc

func Inc[T any](field string, value T) page.FilterCondition

func IsNl

func IsNl[T any](field string, value T) page.FilterCondition

func List

func List[T any](
	ctx context.Context,
	table string,
	filter *[]page.FilterCondition,
	sorts *[]page.SortOrder,
	mapper func(res *sql.Rows) (*T, error),
	paginator *page.Pagination,
) ([]*T, error)

func Lk

func Lk[T any](field string, value T) page.FilterCondition

func NInc

func NInc[T any](field string, value T) page.FilterCondition

func NotEq

func NotEq[T any](field string, value T) page.FilterCondition

func NotNl

func NotNl[T any](field string, value T) page.FilterCondition

func One

func One[T any](
	ctx context.Context,
	table string,
	filter *[]page.FilterCondition,
	sorts *[]page.SortOrder,
	mapper func(res *sql.Row) (*T, error),
) (*T, error)

func Paginator

func Paginator[T any](
	ctx context.Context,
	table string,
	filter *[]page.FilterCondition,
	sorts *[]page.SortOrder,
	paginator *page.Pagination,
	mapper func(res *sql.Rows) (*T, error),
) (page.Paginate[T], error)

func ScanStructRow

func ScanStructRow[T any](st T, rows *sql.Row) (*T, error)

func ScanStructRows

func ScanStructRows[T any](st T, rows *sql.Rows) (*T, error)

func ValidateFilter

func ValidateFilter(filters []page.FilterCondition, validFields map[string]bool) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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