filter

package
v0.0.83 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorAlreadyHydrated = fmt.Errorf("Filter already hydrated. This is a once-only operation to reduce the risk of injection attacks.")

Functions

This section is empty.

Types

type Custom

type Custom struct {
	Col         string
	Values      []string
	CustomID    string
	CustomLabel string
	// contains filtered or unexported fields
}

func (Custom) ID

func (this Custom) ID() string

func (Custom) InputValues added in v0.0.15

func (this Custom) InputValues() []string

func (Custom) Inputs

func (this Custom) Inputs() []string

func (Custom) Label

func (this Custom) Label() string

func (*Custom) Populate

func (this *Custom) Populate(form url.Values) error

func (Custom) Query

func (this Custom) Query(propIndex int) (string, []any)

func (Custom) TableName

func (this Custom) TableName() string

type DateFilter

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

func (*DateFilter) Hydrate

func (this *DateFilter) Hydrate(opts DateFilterOpts) error

func (DateFilter) Inputs

func (this DateFilter) Inputs() []string

func (DateFilter) Period

func (this DateFilter) Period() util.Period

func (*DateFilter) Populate

func (this *DateFilter) Populate(form url.Values) error

func (DateFilter) Query

func (this DateFilter) Query(propIndex int) (string, []any)

type DateFilterOpts

type DateFilterOpts struct {
	Label  string
	ID     string
	Table  string
	Col    string
	Period util.Period
}

type Filter

type Filter interface {
	Label() string
	Query(int) (string, []any)
	ID() string
	Populate(url.Values) error
	Inputs() []string
	TableName() string
}

type FilterSet

type FilterSet struct {
	Filters     Filters
	CustomID    string
	CustomLabel string
	IsAnd       bool
	Values      []string
	// contains filtered or unexported fields
}

func (FilterSet) ID

func (this FilterSet) ID() string

func (FilterSet) InputValues added in v0.0.15

func (this FilterSet) InputValues() []string

func (FilterSet) Inputs

func (this FilterSet) Inputs() []string

func (FilterSet) Label

func (this FilterSet) Label() string

func (*FilterSet) Populate

func (this *FilterSet) Populate(url.Values) error

func (FilterSet) Query

func (this FilterSet) Query(propIndex int) (string, []any)

func (FilterSet) TableName

func (this FilterSet) TableName() string

type Filters

type Filters []Filter

func CommonFilters

func CommonFilters(table string) Filters

func (Filters) Active added in v0.0.60

func (filters Filters) Active(id string) bool

func (Filters) ByID

func (filters Filters) ByID(id string) Filter

func (Filters) Except added in v0.0.61

func (filters Filters) Except(except ...string) Filters

func (*Filters) FromForm

func (filters *Filters) FromForm(form url.Values, availableFilters Filters, customFilters ...Filter) error

func (Filters) IDMap added in v0.0.11

func (filters Filters) IDMap() map[string]Filter

func (Filters) Only added in v0.0.61

func (filters Filters) Only(except ...string) Filters

func (Filters) Query

func (filters Filters) Query(propIndex int) (string, []any)

type HasProp

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

func (*HasProp) Hydrate

func (this *HasProp) Hydrate(opts HasPropOpts) error

func (HasProp) ID

func (this HasProp) ID() string

func (*HasProp) InputValues added in v0.0.15

func (this *HasProp) InputValues() []string

func (HasProp) Inputs

func (this HasProp) Inputs() []string

func (HasProp) Label

func (this HasProp) Label() string

func (*HasProp) Populate

func (this *HasProp) Populate(url.Values) error

func (HasProp) Query

func (this HasProp) Query(propIndex int) (string, []any)

func (HasProp) TableName

func (this HasProp) TableName() string

type HasPropOpts

type HasPropOpts struct {
	Label string
	ID    string
	Table string
	Col   string
	Value string
}

Jump to

Keyboard shortcuts

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