Documentation ¶
Index ¶
- type Filter
- type Pager
- type Values
- func (v Values) Bool(name string) (bool, error)
- func (v Values) Duration(name string) (time.Duration, error)
- func (v Values) Float64(name string) (float64, error)
- func (v Values) Has(name string) bool
- func (v Values) Int(name string) (int, error)
- func (v Values) Int64(name string) (int64, error)
- func (v Values) MaybeBool(name string) bool
- func (v Values) MaybeDuration(name string) time.Duration
- func (v Values) MaybeFloat64(name string) float64
- func (v Values) MaybeInt(name string) int
- func (v Values) MaybeInt64(name string) int64
- func (v Values) MaybeTime(name string) time.Time
- func (v Values) Pager() *Pager
- func (v Values) SetDefault(name string, values ...string)
- func (v Values) String(name string) string
- func (v Values) Strings(name string) []string
- func (v Values) Time(name string) (time.Time, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct { Deterministic bool // if true internal map gets printed in its order, otherwise flaky tests. Values Values // contains filtered or unexported fields }
URLFilter is used with Query.Apply to add WHERE clauses from the URL values:
- ?foo=bar - Where(`"foo" = 'bar'`)
- ?foo=hello&foo=world - Where(`"foo" IN ('hello','world')`)
- ?foo__eq=bar - Where(`"foo" = 'bar'`)
- ?foo__neq=bar - Where(`"foo" != 'bar'`)
- ?foo__exclude=bar - Where(`"foo" != 'bar'`)
- ?foo__gt=42 - Where(`"foo" > 42`)
- ?foo__gte=42 - Where(`"foo" >= 42`)
- ?foo__from=42&foo__to=100 - Where(`"foo" >= 42` AND `foo` <= 100)
- ?foo__lt=42 - Where(`"foo" < 42`)
- ?foo__lte=42 - Where(`"foo" <= 42`)
- ?foo__null= - Where(`"foo" IS NULL`)
- ?foo__notnull= - Where(`"foo" IS NOT NULL`)
- ?foo__lte=42&foo__sort=desc - WHERE `foo` <= 42 ORDER BY `foo` DESC
- ?foo__lte=42&foo__sort=asc - WHERE `foo` <= 42 ORDER BY `foo` ASC
- ?foo__like=bar - Where(`"foo" LIKE 'bar'`)
- ?foo__nlike=bar - Where(`"foo" NOT LIKE 'bar'`)
- ?foo__match=bar - Where(`"foo" SIMILAR TO 'bar'`)
- ?foo__ss=bar - Where(`"foo" <=> 'bar'`) // space ship operator
func (*Filter) Filters ¶
func (f *Filter) Filters(tbl *ddl.Table, cond dml.Conditions) (_ dml.Conditions, sortOrder []string)
Filters builds the SQL conditions by appending to slice `cond` and returning it.
type Pager ¶
type Pager struct { Limit uint64 Offset uint64 // Default max limit is 1000. MaxLimit uint64 // Default max offset is 1000000. MaxOffset uint64 // contains filtered or unexported fields }
func (*Pager) FromValues ¶
type Values ¶
Values same as net/url so use url.ParseQuery to get a parsed query string.
func (Values) MaybeFloat64 ¶
func (Values) MaybeInt64 ¶
func (Values) SetDefault ¶
Click to show internal directories.
Click to hide internal directories.