Documentation
¶
Index ¶
- Constants
- Variables
- func CreateMutation[In any](def Mutation[In]) func(ctx context.Context, args In) error
- func CreateMutationEx[In any, Ext any](def MutationEx[In, Ext]) func(ctx context.Context, args In, ext Ext) error
- func CreateQuery[In any, Out any](def Query[In, Out]) func(ctx context.Context, args In) (Out, error)
- func CreateQueryEx[In any, Out any, Ext any](def QueryEx[In, Out, Ext]) func(ctx context.Context, args In, ext Ext) (Out, error)
- func CreateQueryMutation[In any, Out any](def QueryMutation[In, Out]) func(ctx context.Context, args In) (Out, error)
- func CreateQueryMutationEx[In any, Out any, Ext any](def QueryMutationEx[In, Out, Ext]) func(ctx context.Context, args In, ext Ext) (Out, error)
- func FormatContinuation(sid uint32, directions []uint8, values []any, reverse, include bool) (string, error)
- func NewContext(ctx context.Context, db bun.IDB, mods ...QueryMod) context.Context
- func PascalToDelimited(s string, delim string) string
- func UseContextMods(ctx context.Context, mods ...QueryMod) (context.Context, error)
- func UseMutation(ctx context.Context, fn func(ctx context.Context, db MutationDB) error, ...) error
- func UseQuery(ctx context.Context, fn func(ctx context.Context, db QueryDB) error, ...) error
- type AnyOpt
- type Continuation
- type Mutation
- type MutationDB
- type MutationEx
- type MutationOpt
- type MutationOpts
- type Pager
- func NewPager[M Sortable](model M, opts ...PagerOption) (*Pager[M], error)
- func NewPagerFromContinuation[M Sortable](token string, opts ...PagerOption) (*Pager[M], error)
- func NewPagerFromOrder[M Sortable](model M, order string, opts ...PagerOption) (*Pager[M], error)
- func NewPagerFromRequest[M Sortable](model M, req PagingRequest, opts ...PagerOption) (*Pager[M], error)
- func NewPagerFromSID[M Sortable](sid uint32, opts ...PagerOption) (*Pager[M], error)
- type PagerOption
- type PagerOptions
- type PagingRequest
- type Patch
- type Query
- type QueryAppenderFunc
- type QueryBuilderEx
- type QueryDB
- type QueryEx
- type QueryMod
- type QueryMods
- type QueryMutation
- type QueryMutationEx
- type QueryOpt
- type QueryOpts
- type ResourcePatcher
- type Sort
- type Sortable
- type SupportsQueryBuilderEx
Constants ¶
View Source
const ( SortAscending uint8 = 0x00 SortDescending uint8 = 0x01 SortUnknown uint8 = 0xFF )
Variables ¶
View Source
var ErrNoContext = errors.New("no db context")
Functions ¶
func CreateMutation ¶
func CreateMutationEx ¶
func CreateQuery ¶
func CreateQueryEx ¶
func CreateQueryMutation ¶
func CreateQueryMutationEx ¶
func FormatContinuation ¶
func NewContext ¶
func PascalToDelimited ¶
func UseContextMods ¶
func UseMutation ¶
Types ¶
type Continuation ¶
func NewContinuation ¶
func NewContinuation(sid uint32, directions []uint8, values []any, reverse, include bool) *Continuation
func ParseContinuation ¶
func ParseContinuation(token string) (*Continuation, error)
func (*Continuation) String ¶
func (c *Continuation) String() (string, error)
type MutationDB ¶
type MutationDB interface {
QueryDB
NewInsert() *bun.InsertQuery
NewUpdate(bindArgs ...any) *bun.UpdateQuery
NewDelete(bindArgs ...any) *bun.DeleteQuery
}
type MutationEx ¶
type MutationOpt ¶
type MutationOpt func(*MutationOpts)
func WithTxOptions ¶
func WithTxOptions(txOptions *sql.TxOptions) MutationOpt
func (MutationOpt) Apply ¶
func (opt MutationOpt) Apply(opts any)
type MutationOpts ¶
func NewMutationOpts ¶
func NewMutationOpts(opts ...AnyOpt) *MutationOpts
type Pager ¶
type Pager[M Sortable] struct { // contains filtered or unexported fields }
func NewPagerFromContinuation ¶
func NewPagerFromContinuation[M Sortable](token string, opts ...PagerOption) (*Pager[M], error)
func NewPagerFromOrder ¶
func NewPagerFromOrder[M Sortable](model M, order string, opts ...PagerOption) (*Pager[M], error)
func NewPagerFromRequest ¶
func NewPagerFromRequest[M Sortable](model M, req PagingRequest, opts ...PagerOption) (*Pager[M], error)
func NewPagerFromSID ¶
func NewPagerFromSID[M Sortable](sid uint32, opts ...PagerOption) (*Pager[M], error)
func (*Pager[M]) Compile ¶
func (p *Pager[M]) Compile() func(qry *bun.SelectQuery) *bun.SelectQuery
type PagerOption ¶
type PagerOption = func(*PagerOptions)
func WithForwardOnly ¶
func WithForwardOnly() PagerOption
func WithPageSize ¶
func WithPageSize(size int) PagerOption
type PagerOptions ¶
func NewOptions ¶
func NewOptions(opts ...PagerOption) *PagerOptions
type PagingRequest ¶
type Patch ¶
func CreatePatch ¶
func (*Patch[Target, Derived]) Compile ¶
func (patch *Patch[Target, Derived]) Compile() func(*bun.UpdateQuery) *bun.UpdateQuery
type QueryAppenderFunc ¶
func TableAlias ¶
func TableAlias(value any) QueryAppenderFunc
func TableName ¶
func TableName(value any) QueryAppenderFunc
func (QueryAppenderFunc) AppendQuery ¶
type QueryBuilderEx ¶
type QueryBuilderEx interface {
bun.QueryBuilder
With(name string, query bun.Query) QueryBuilderEx
Err(err error) QueryBuilderEx
}
func NewQueryBuilderEx ¶
func NewQueryBuilderEx[Query any, Source SupportsQueryBuilderEx[Query]](qry Source) QueryBuilderEx
type QueryDB ¶
type QueryDB interface {
Unwrap() bun.IDB
NewSelect(bindArgs ...any) *bun.SelectQuery
}
type QueryMod ¶
func NewQueryMod ¶
type QueryMutation ¶
type QueryMutationEx ¶
type ResourcePatcher ¶
type ResourcePatcher[Resource any] interface { Target() *Resource }
type Sort ¶
type Sort[M Sortable] struct { // contains filtered or unexported fields }
func (*Sort[M]) MustRegister ¶
type SupportsQueryBuilderEx ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.