strategy_filter

package
v1.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRemote  = "remote"
	TypePattern = "pattern"
	TypeStatic  = "static"

	ValuesALL = "ALL"

	ScopeGlobal  = "global"
	ScopeTeam    = "team"
	ScopeService = "service"
)
View Source
const (
	HttpALL = "ALL"
)

Variables

View Source
var (
	ApiPathRegexp = `^\*?[\w-/]+\*?$`
)
View Source
var (
	CIDRIpv4Exp = `` /* 138-byte string literal not displayed */
)

Functions

func CheckFilters

func CheckFilters(name string, scope strategy_dto.Scope, filters []*strategy_dto.Filter) error

func Options

func Options(scope string) (map[string]*Option, bool)

func RegisterRemoteFilter

func RegisterRemoteFilter(filter IRemoteFilter)

Types

type Handler

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

func NewHandler

func NewHandler() *Handler

func (*Handler) FilterLabel

func (f *Handler) FilterLabel(name string, values []string) (*Info, error)

func (*Handler) Options

func (f *Handler) Options(scope string) (map[string]*Option, bool)

func (*Handler) RegisterFilter

func (f *Handler) RegisterFilter(filter IFilter)

func (*Handler) RegisterRemoteFilter

func (f *Handler) RegisterRemoteFilter(filter IRemoteFilter)

func (*Handler) RemoteFilter

func (f *Handler) RemoteFilter(name string) (IRemoteFilter, bool)

type IFilter

type IFilter interface {
	Name() string
	Title() string
	Labels(values ...string) []string
	Type() string
	Scopes() []string
	Option() *Option
}

func FilterGet

func FilterGet(name string) (IFilter, bool)

type IFilterHandler

type IFilterHandler interface {
	RemoteFilter(name string) (IRemoteFilter, bool)
	Options(scope string) (map[string]*Option, bool)
	FilterLabel(name string, values []string) (*Info, error)
}

type IRemoteFilter

type IRemoteFilter interface {
	IFilter
	Titles() []OptionTitle
	Key() string
	Target() string
	RemoteList(ctx context.Context, keyword string, condition map[string]interface{}, page int, pageSize int) ([]any, int64, error)
}

func RemoteFilter

func RemoteFilter(name string) (IRemoteFilter, bool)

type Info

type Info struct {
	Title string
	Label string
}

func FilterLabel

func FilterLabel(name string, values []string) (*Info, error)

type Option

type Option struct {
	Name    string
	Title   string
	Type    string
	Pattern *regexp.Regexp
	Options []string
}

type OptionTitle

type OptionTitle struct {
	Field string `json:"field"`
	Title string `json:"title" aoi18n:""`
}

type ScopeFilterOption

type ScopeFilterOption eosc.Untyped[string, *Option]

Jump to

Keyboard shortcuts

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