Documentation
¶
Index ¶
- type BaseFilter
- func (s *BaseFilter) AddFilter(key FilterType, value string)
- func (s *BaseFilter) AddRegex(name FilterType, pattern *regexp.Regexp)
- func (s *BaseFilter) AddValidation(name FilterType, f func(interface{}) bool)
- func (s *BaseFilter) GetEntity(name FilterType) []string
- func (s *BaseFilter) GetFilter(key FilterType) string
- func (s *BaseFilter) GetTypes() []string
- func (s *BaseFilter) Init()
- func (s *BaseFilter) InvokeValidation(name FilterType, i interface{}) bool
- func (s *BaseFilter) ValidateAll(items interface{}) bool
- type Filter
- type FilterType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseFilter ¶
type BaseFilter struct {
// contains filtered or unexported fields
}
BaseFilter is designed to be fairly generic, there shouldn't be any reason to extend it, but if you have a specialized use case feel free to do so.
func NewBaseFilter ¶
func NewBaseFilter() *BaseFilter
func (*BaseFilter) AddFilter ¶
func (s *BaseFilter) AddFilter(key FilterType, value string)
AddFilter adds a filter and the corresponding value
func (*BaseFilter) AddRegex ¶
func (s *BaseFilter) AddRegex(name FilterType, pattern *regexp.Regexp)
func (*BaseFilter) AddValidation ¶
func (s *BaseFilter) AddValidation(name FilterType, f func(interface{}) bool)
func (*BaseFilter) GetEntity ¶
func (s *BaseFilter) GetEntity(name FilterType) []string
func (*BaseFilter) GetFilter ¶
func (s *BaseFilter) GetFilter(key FilterType) string
GetFilter returns the value of the filter
func (*BaseFilter) GetTypes ¶
func (s *BaseFilter) GetTypes() []string
GetTypes returns all the current keys for the configured Filter
func (*BaseFilter) Init ¶
func (s *BaseFilter) Init()
func (*BaseFilter) InvokeValidation ¶
func (s *BaseFilter) InvokeValidation(name FilterType, i interface{}) bool
func (*BaseFilter) ValidateAll ¶
func (s *BaseFilter) ValidateAll(items interface{}) bool
Validate Iterates through all validation checks
type Filter ¶
type Filter interface {
//Regex Tooling
AddRegex(FilterType, *regexp.Regexp)
//Entity filterMap
GetEntity(FilterType) []string // Returns slice of filter values or default value from Config
GetFilter(key FilterType) string //Get the Filter value
AddFilter(key FilterType, value string) //Add a filter to match against for a given type
ValidateAll(interface{}) bool //ValidateAll if Entry is valid
InvokeValidation(FilterType, interface{}) bool
AddValidation(FilterType, func(interface{}) bool)
}
type FilterType ¶
type FilterType string
FilterType Currently supported filters
const ( TagsFilter FilterType = "TagsFilter" DashFilter FilterType = "DashFilter" FolderFilter FilterType = "FolderFilter" DefaultFilter FilterType = "default" Name FilterType = "Name" )
func (FilterType) String ¶
func (s FilterType) String() string
Click to show internal directories.
Click to hide internal directories.