filter

package
v0.0.0-...-b45a7ae Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByEntityAttribute

type ByEntityAttribute struct {
	FormDisplayName string
	FormFieldName   string

	FilterEntityKey entity.Key

	ProductCompoundField              string
	ProductFilteredAttributeFieldName string
}

func (*ByEntityAttribute) ParseQueryParameters

func (f *ByEntityAttribute) ParseQueryParameters(query url.Values) Instance

type ByMappedStructValueInArrayField

type ByMappedStructValueInArrayField struct {
	FormDisplayName string
	FormFieldName   string

	FieldName                string
	StructValueToFilterValue func(interface{}) string
	BuildCondition           func(fieldName string, values []string) query.Expression

	// TODO: probably responsibility of an wrapper, or of ViewModel post-processing,...
	// (any filter / ViewModel could use sorting)
	LessFunc func(string, string) bool
}

func (*ByMappedStructValueInArrayField) ParseQueryParameters

func (f *ByMappedStructValueInArrayField) ParseQueryParameters(query url.Values) Instance

type Filter

type Filter interface {
	ParseQueryParameters(query url.Values) Instance
}

type Group

type Group struct {
	Filters []Filter
}

func (*Group) ParseQuery

func (g *Group) ParseQuery(query url.Values) *GroupInstance

type GroupInstance

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

func (*GroupInstance) BuildConditions

func (i *GroupInstance) BuildConditions() []query.Expression

func (*GroupInstance) BuildViewModels

func (i *GroupInstance) BuildViewModels(accessor model.DomainAccessor, relevantInstances []projection.Instance) []ViewModel

TODO: coupled to projection.Instance,... could support both entities and projections

func (*GroupInstance) QueryParams

func (i *GroupInstance) QueryParams() []string

TODO: maybe return url.Values

type Instance

type Instance interface {
	Present() bool
	BuildCondition() query.Expression
	QueryParams() []string
	BuildOptions(accessor model.DomainAccessor, instances []projection.Instance) ViewModel
}

type ViewModel

type ViewModel struct {
	Name      string
	FieldName string
	Options   []ViewModelOption

	AnythingChecked bool

	ClearURL string
}

type ViewModelOption

type ViewModelOption struct {
	Name, Value string
	Checked     bool
}

Jump to

Keyboard shortcuts

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