yaorm: github.com/geoffreybauduin/yaorm/yaormfilter Index | Files

package yaormfilter

import "github.com/geoffreybauduin/yaorm/yaormfilter"

Index

Package Files

boolfilter.go datefilter.go filter.go int64filter.go nilfilter.go stringfilter.go tools.go valuefilter.go

Variables

var OrderingWays = struct {
    Asc  OrderingWay
    Desc OrderingWay
}{
    Asc:  "ASC",
    Desc: "DESC",
}

OrderingWays represents the Enum to have ordering

var RequestOptions = struct {
    SelectForUpdate RequestOption
    SelectDistinct  RequestOption
    LeftJoin        RequestOption
}{
    SelectForUpdate: "SelectForUpdate",
    SelectDistinct:  "SelectDistinct",
    LeftJoin:        "LeftJoin",
}

RequestOptions represents the Enum of Request options

type BoolFilter Uses

type BoolFilter struct {
    // contains filtered or unexported fields
}

BoolFilter is the filter used to filter on bool fields. Implements ValueFilter

func (*BoolFilter) Apply Uses

func (f *BoolFilter) Apply(statement squirrel.SelectBuilder, tableName, fieldName string) squirrel.SelectBuilder

func (*BoolFilter) Equals Uses

func (f *BoolFilter) Equals(v interface{}) ValueFilter

Equals adds an equal filter

func (BoolFilter) GetEquality Uses

func (f BoolFilter) GetEquality() interface{}

func (*BoolFilter) Gt Uses

func (f *BoolFilter) Gt(v interface{}) ValueFilter

Gt is not applicable on bool

func (*BoolFilter) Gte Uses

func (f *BoolFilter) Gte(v interface{}) ValueFilter

Gte is not applicable on bool

func (*BoolFilter) In Uses

func (f *BoolFilter) In(values ...interface{}) ValueFilter

In adds a IN filter

func (BoolFilter) IsEquality Uses

func (f BoolFilter) IsEquality() bool

func (*BoolFilter) Like Uses

func (f *BoolFilter) Like(v interface{}) ValueFilter

Like is not applicable on bool

func (*BoolFilter) Lt Uses

func (f *BoolFilter) Lt(v interface{}) ValueFilter

Lt is not applicable on bool

func (*BoolFilter) Lte Uses

func (f *BoolFilter) Lte(v interface{}) ValueFilter

Lte is not applicable on bool

func (*BoolFilter) Nil Uses

func (f *BoolFilter) Nil(v bool) ValueFilter

Nil adds a nil filter

func (*BoolFilter) NotEquals Uses

func (f *BoolFilter) NotEquals(v interface{}) ValueFilter

NotEquals adds an notEqual filter

func (*BoolFilter) NotIn Uses

func (f *BoolFilter) NotIn(values ...interface{}) ValueFilter

NotIn adds a NOT IN filter

func (*BoolFilter) Raw Uses

func (f *BoolFilter) Raw(s RawFilterFunc) ValueFilter

Raw performs a Raw filter

type DateFilter Uses

type DateFilter struct {
    // contains filtered or unexported fields
}

DateFilter is a filter to operate on date fields

func (*DateFilter) Apply Uses

func (f *DateFilter) Apply(statement squirrel.SelectBuilder, tableName, fieldName string) squirrel.SelectBuilder

func (*DateFilter) Equals Uses

func (f *DateFilter) Equals(v interface{}) ValueFilter

Equals applies an equal filter on Date

func (DateFilter) GetEquality Uses

func (f DateFilter) GetEquality() interface{}

func (*DateFilter) Gt Uses

func (f *DateFilter) Gt(v interface{}) ValueFilter

Gt adds a > filter

func (*DateFilter) Gte Uses

func (f *DateFilter) Gte(v interface{}) ValueFilter

Gte adds a > filter

func (*DateFilter) In Uses

func (f *DateFilter) In(values ...interface{}) ValueFilter

In adds a IN filter (not implemented)

func (DateFilter) IsEquality Uses

func (f DateFilter) IsEquality() bool

func (*DateFilter) Like Uses

func (f *DateFilter) Like(v interface{}) ValueFilter

Like is not applicable on Date

func (*DateFilter) Lt Uses

func (f *DateFilter) Lt(v interface{}) ValueFilter

Lt adds a < filter

func (*DateFilter) Lte Uses

func (f *DateFilter) Lte(v interface{}) ValueFilter

Lte adds a <= filter

func (*DateFilter) Nil Uses

func (f *DateFilter) Nil(v bool) ValueFilter

Nil applies a nil filter on Date

func (*DateFilter) NotEquals Uses

func (f *DateFilter) NotEquals(v interface{}) ValueFilter

NotEquals applies an notEqual filter on Date

func (*DateFilter) NotIn Uses

func (f *DateFilter) NotIn(values ...interface{}) ValueFilter

NotIn adds a NOT IN filter (not implemented)

func (*DateFilter) Raw Uses

func (f *DateFilter) Raw(s RawFilterFunc) ValueFilter

Raw performs a Raw filter

type Filter Uses

type Filter interface {
    Subqueryload() Filter
    ShouldSubqueryload() bool
    AddOption(opt RequestOption) Filter
    GetSelectOptions() []RequestOption
    OrderBy(field string, way OrderingWay) Filter
    GetOrderBy() []*OrderBy
    Limit(limit uint64) Filter
    Offset(offset uint64) Filter
    GetLimit() (bool, uint64)
    GetOffset() (bool, uint64)
    LoadColumns(columns ...string)
    GetLoadColumns() []string
    DontLoadColumns(columns ...string)
    GetDontLoadColumns() []string
}

Filter is the interface stating the methods to implement to correctly filter on models

type Int64Filter Uses

type Int64Filter struct {
    // contains filtered or unexported fields
}

Int64Filter is the filter used to filter on int64 fields. Implements ValueFilter

func (*Int64Filter) Apply Uses

func (f *Int64Filter) Apply(statement squirrel.SelectBuilder, tableName, fieldName string) squirrel.SelectBuilder

func (*Int64Filter) Equals Uses

func (f *Int64Filter) Equals(v interface{}) ValueFilter

Equals adds an equal filter

func (Int64Filter) GetEquality Uses

func (f Int64Filter) GetEquality() interface{}

func (*Int64Filter) Gt Uses

func (f *Int64Filter) Gt(v interface{}) ValueFilter

Gt adds a > filter

func (*Int64Filter) Gte Uses

func (f *Int64Filter) Gte(v interface{}) ValueFilter

Gte adds a > filter

func (*Int64Filter) In Uses

func (f *Int64Filter) In(values ...interface{}) ValueFilter

In adds a IN filter

func (Int64Filter) IsEquality Uses

func (f Int64Filter) IsEquality() bool

func (*Int64Filter) Like Uses

func (f *Int64Filter) Like(v interface{}) ValueFilter

Like is not applicable on int64

func (*Int64Filter) Lt Uses

func (f *Int64Filter) Lt(v interface{}) ValueFilter

Lt adds a < filter

func (*Int64Filter) Lte Uses

func (f *Int64Filter) Lte(v interface{}) ValueFilter

Lte adds a <= filter

func (*Int64Filter) Nil Uses

func (f *Int64Filter) Nil(v bool) ValueFilter

Nil adds a nil filter

func (*Int64Filter) NotEquals Uses

func (f *Int64Filter) NotEquals(v interface{}) ValueFilter

NotEquals adds an notEqual filter

func (*Int64Filter) NotIn Uses

func (f *Int64Filter) NotIn(values ...interface{}) ValueFilter

NotIn adds a NOT IN filter

func (*Int64Filter) Raw Uses

func (f *Int64Filter) Raw(s RawFilterFunc) ValueFilter

Raw performs a Raw filter

type ModelFilter Uses

type ModelFilter struct {
    // contains filtered or unexported fields
}

ModelFilter is the struct every filter should compose

func (*ModelFilter) AddOption Uses

func (mf *ModelFilter) AddOption(opt RequestOption) Filter

func (*ModelFilter) AddOption_ Uses

func (mf *ModelFilter) AddOption_(opt RequestOption)

func (*ModelFilter) AllowSubqueryload Uses

func (mf *ModelFilter) AllowSubqueryload() Filter

func (*ModelFilter) Distinct Uses

func (mf *ModelFilter) Distinct()

func (*ModelFilter) DontLoadColumns Uses

func (mf *ModelFilter) DontLoadColumns(columns ...string)

func (*ModelFilter) GetDontLoadColumns Uses

func (mf *ModelFilter) GetDontLoadColumns() []string

func (*ModelFilter) GetLimit Uses

func (mf *ModelFilter) GetLimit() (bool, uint64)

func (*ModelFilter) GetLoadColumns Uses

func (mf *ModelFilter) GetLoadColumns() []string

func (*ModelFilter) GetOffset Uses

func (mf *ModelFilter) GetOffset() (bool, uint64)

func (*ModelFilter) GetOrderBy Uses

func (mf *ModelFilter) GetOrderBy() []*OrderBy

func (*ModelFilter) GetSelectOptions Uses

func (mf *ModelFilter) GetSelectOptions() []RequestOption

func (*ModelFilter) Limit Uses

func (mf *ModelFilter) Limit(limit uint64) Filter

func (*ModelFilter) LoadColumns Uses

func (mf *ModelFilter) LoadColumns(columns ...string)

func (*ModelFilter) Offset Uses

func (mf *ModelFilter) Offset(limit uint64) Filter

func (*ModelFilter) OrderBy Uses

func (mf *ModelFilter) OrderBy(field string, way OrderingWay) Filter

func (*ModelFilter) SetLimit Uses

func (mf *ModelFilter) SetLimit(limit uint64)

func (*ModelFilter) SetOffset Uses

func (mf *ModelFilter) SetOffset(offset uint64)

func (*ModelFilter) SetOrderBy Uses

func (mf *ModelFilter) SetOrderBy(field string, way OrderingWay) Filter

func (*ModelFilter) ShouldSubqueryload Uses

func (mf *ModelFilter) ShouldSubqueryload() bool

func (*ModelFilter) Subqueryload Uses

func (mf *ModelFilter) Subqueryload() Filter

type NilFilter Uses

type NilFilter struct {
    // contains filtered or unexported fields
}

NilFilter is a filter to operate on unknown nil fields

func (*NilFilter) Apply Uses

func (f *NilFilter) Apply(statement squirrel.SelectBuilder, tableName, fieldName string) squirrel.SelectBuilder

func (*NilFilter) Equals Uses

func (f *NilFilter) Equals(v interface{}) ValueFilter

Equals applies an equal filter on Date

func (NilFilter) GetEquality Uses

func (f NilFilter) GetEquality() interface{}

func (*NilFilter) Gt Uses

func (f *NilFilter) Gt(v interface{}) ValueFilter

Gt adds a > filter

func (*NilFilter) Gte Uses

func (f *NilFilter) Gte(v interface{}) ValueFilter

Gte adds a > filter

func (*NilFilter) In Uses

func (f *NilFilter) In(values ...interface{}) ValueFilter

In adds a IN filter (not implemented)

func (NilFilter) IsEquality Uses

func (f NilFilter) IsEquality() bool

func (*NilFilter) Like Uses

func (f *NilFilter) Like(v interface{}) ValueFilter

Like is not applicable on Date

func (*NilFilter) Lt Uses

func (f *NilFilter) Lt(v interface{}) ValueFilter

Lt adds a < filter

func (*NilFilter) Lte Uses

func (f *NilFilter) Lte(v interface{}) ValueFilter

Lte adds a <= filter

func (*NilFilter) Nil Uses

func (f *NilFilter) Nil(v bool) ValueFilter

Nil applies a nil filter on Date

func (*NilFilter) NotEquals Uses

func (f *NilFilter) NotEquals(v interface{}) ValueFilter

NotEquals applies an notEqual filter

func (*NilFilter) NotIn Uses

func (f *NilFilter) NotIn(values ...interface{}) ValueFilter

NotIn adds a NOT IN filter (not implemented)

func (*NilFilter) Raw Uses

func (f *NilFilter) Raw(s RawFilterFunc) ValueFilter

Raw performs a Raw filter

type OrderBy Uses

type OrderBy struct {
    Field string
    Way   OrderingWay
}

type OrderingWay Uses

type OrderingWay string

OrderingWay is a custom type to have ordering

type RawFilterFunc Uses

type RawFilterFunc func(string) interface{}

type RequestOption Uses

type RequestOption string

RequestOption is a custom type to have request options

type StringFilter Uses

type StringFilter struct {
    // contains filtered or unexported fields
}

func (*StringFilter) Apply Uses

func (f *StringFilter) Apply(statement squirrel.SelectBuilder, tableName, fieldName string) squirrel.SelectBuilder

func (*StringFilter) Equals Uses

func (f *StringFilter) Equals(v interface{}) ValueFilter

Equals adds an equal filter

func (StringFilter) GetEquality Uses

func (f StringFilter) GetEquality() interface{}

func (*StringFilter) Gt Uses

func (f *StringFilter) Gt(v interface{}) ValueFilter

Gt adds a > filter

func (*StringFilter) Gte Uses

func (f *StringFilter) Gte(v interface{}) ValueFilter

Gte adds a > filter

func (*StringFilter) In Uses

func (f *StringFilter) In(values ...interface{}) ValueFilter

In adds a IN filter

func (StringFilter) IsEquality Uses

func (f StringFilter) IsEquality() bool

func (*StringFilter) Like Uses

func (f *StringFilter) Like(v interface{}) ValueFilter

Like adds a Like filter

func (*StringFilter) Lt Uses

func (f *StringFilter) Lt(v interface{}) ValueFilter

Lt adds a < filter

func (*StringFilter) Lte Uses

func (f *StringFilter) Lte(v interface{}) ValueFilter

Lte adds a <= filter

func (*StringFilter) Nil Uses

func (f *StringFilter) Nil(v bool) ValueFilter

Nil adds a nil filter

func (*StringFilter) NotEquals Uses

func (f *StringFilter) NotEquals(v interface{}) ValueFilter

NotEquals adds an notEqual filter

func (*StringFilter) NotIn Uses

func (f *StringFilter) NotIn(values ...interface{}) ValueFilter

NotIn adds a NOT IN filter

func (*StringFilter) Raw Uses

func (f *StringFilter) Raw(s RawFilterFunc) ValueFilter

Raw performs a Raw filter

type ValueFilter Uses

type ValueFilter interface {
    Apply(statement squirrel.SelectBuilder, tableName, fieldName string) squirrel.SelectBuilder
    Equals(v interface{}) ValueFilter
    NotEquals(v interface{}) ValueFilter
    Like(v interface{}) ValueFilter
    Lt(v interface{}) ValueFilter
    Lte(v interface{}) ValueFilter
    Gt(v interface{}) ValueFilter
    Gte(v interface{}) ValueFilter
    Nil(v bool) ValueFilter
    In(v ...interface{}) ValueFilter
    NotIn(v ...interface{}) ValueFilter
    Raw(fn RawFilterFunc) ValueFilter
    IsEquality() bool
    GetEquality() interface{}
}

func Equals Uses

func Equals(v interface{}) ValueFilter

Equals returns the correct filter according the value sent

func Gt Uses

func Gt(v interface{}) ValueFilter

Gt returns the correct filter according the value sent

func Gte Uses

func Gte(v interface{}) ValueFilter

Gte returns the correct filter according the value sent

func In Uses

func In(values ...interface{}) ValueFilter

In returns the correct filter according to the value sent

func Like Uses

func Like(v interface{}) ValueFilter

Like returns the correct filter according to the value sent

func Lt Uses

func Lt(v interface{}) ValueFilter

Lt returns the correct filter according the value sent

func Lte Uses

func Lte(v interface{}) ValueFilter

Lte returns the correct filter according the value sent

func NewBoolFilter Uses

func NewBoolFilter() ValueFilter

NewBoolFilter returns a new bool filter

func NewDateFilter Uses

func NewDateFilter() ValueFilter

NewDateFilter returns a new DateFilter

func NewInt64Filter Uses

func NewInt64Filter() ValueFilter

NewInt64Filter returns a new int64 filter

func NewNilFilter Uses

func NewNilFilter() ValueFilter

NewNilFilter returns a new NilFilter

func NewStringFilter Uses

func NewStringFilter() ValueFilter

NewStringFilter returns a new string filter

func NotEquals Uses

func NotEquals(v interface{}) ValueFilter

NotEquals returns the correct filter according the value sent

func NotIn Uses

func NotIn(values ...interface{}) ValueFilter

NotIn returns the correct filter according to the value sent

func Raw Uses

func Raw(v RawFilterFunc) ValueFilter

Raw returns the correct filter according the value sent

Package yaormfilter imports 6 packages (graph) and is imported by 1 packages. Updated 2020-10-20. Refresh now. Tools for package owners.