query

package
v0.0.0-...-dd08621 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArgsMustBePointer = fmt.Errorf("Args object should be pointer")
View Source
var ErrInvalidFilterOperator = errors.New("Invalid Filter Operation")

Functions

func Build

func Build(pargs interface{}, builder squirrel.SelectBuilder, except ...string) (squirrel.SelectBuilder, error)

Build add condition to db

Types

type FindOptions

type FindOptions struct {
	SelectForUpdate *bool

	Pagination *Pagination
	SortBy     SortBys
}

func Find

func Find() *FindOptions

func MergeFindOptions

func MergeFindOptions(opts ...*FindOptions) *FindOptions

func (*FindOptions) Query

func (f *FindOptions) Query(field string, builder squirrel.SelectBuilder) (squirrel.SelectBuilder, error)

func (*FindOptions) SetPagination

func (f *FindOptions) SetPagination(from uint64, size uint64) *FindOptions

func (*FindOptions) SetSelectForUpdate

func (f *FindOptions) SetSelectForUpdate(v bool) *FindOptions

func (*FindOptions) SetSortBy

func (f *FindOptions) SetSortBy(sortBy ...SortBy) *FindOptions

type IntQuery

type IntQuery []SingleIntQuery

func (IntQuery) Query

func (q IntQuery) Query(field string, builder squirrel.SelectBuilder) (squirrel.SelectBuilder, error)

type Pagination

type Pagination struct {
	From *uint64
	Size *uint64
}

func (*Pagination) Query

func (p *Pagination) Query(field string, builder squirrel.SelectBuilder) (squirrel.SelectBuilder, error)

type Query

type Query interface {
	Query(field string, builder squirrel.SelectBuilder) (squirrel.SelectBuilder, error)
}

type SingleIntQuery

type SingleIntQuery struct {
	Op string `json:"op"`
	T  uint   `json:"t"`
}

type SingleStringQuery

type SingleStringQuery struct {
	Op string `json:"op"`
	T  string `json:"t"`
}

type SortBy

type SortBy struct {
	Field string
	Asc   bool
}

type SortBys

type SortBys []SortBy

func (SortBys) Query

func (s SortBys) Query(field string, builder squirrel.SelectBuilder) (squirrel.SelectBuilder, error)

type StringQuery

type StringQuery []SingleStringQuery

func (StringQuery) Query

type TimeRange

type TimeRange struct {
	From sql.NullTime `db:"from"`
	To   sql.NullTime `db:"to"`
}

func (TimeRange) Query

func (r TimeRange) Query(field string, builder squirrel.SelectBuilder) (squirrel.SelectBuilder, error)

Jump to

Keyboard shortcuts

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