Documentation ¶
Index ¶
- func Configure(ctx logging.Context, cfg *Config) error
- func ConfigureWithData(ctx logging.Context, data []byte) error
- func Evaluate(cfg *Config) error
- func ParseConditions(r Registry, list []Condition) ([]logging.Condition, error)
- func RegisterCondition(name string, ty ConditionType)
- func RegisterRule(name string, ty RuleType)
- func RegisterValueType(name string, ty ValueType)
- type AndType
- type AttributeType
- type Condition
- type ConditionType
- type ConditionalRuleType
- type Config
- type GenericValueType
- type NotType
- type OrType
- type RealmPrefixType
- type RealmType
- type Registry
- type Rule
- type RuleType
- type TagType
- type Value
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseConditions ¶
func RegisterCondition ¶
func RegisterCondition(name string, ty ConditionType)
func RegisterRule ¶
func RegisterValueType ¶
Types ¶
type AndType ¶
AndType should be []Condition, but this does not work with Go Generics so, just explode the type, and it magically works.
type AttributeType ¶
type ConditionalRuleType ¶
type Config ¶
type Config struct { DefaultLevel string `json:"defaultLevel,omitempty"` Rules []Rule `json:"rules,omitempty"` }
func EvaluateFromData ¶
func (*Config) UnmarshalFrom ¶
type GenericValueType ¶
type GenericValueType struct {
Value interface{}
}
func (GenericValueType) Create ¶
func (m GenericValueType) Create(r Registry) (interface{}, error)
func (GenericValueType) MarshalJSON ¶
func (m GenericValueType) MarshalJSON() ([]byte, error)
MarshalJSON returns m as the JSON encoding of m.
func (*GenericValueType) UnmarshalJSON ¶
func (m *GenericValueType) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *m to a copy of data.
type RealmPrefixType ¶
type RealmPrefixType string
type Registry ¶
type Registry interface { RegisterRuleType(name string, ty RuleType) RegisterConditionType(name string, ty ConditionType) RegisterValueType(name string, ty ValueType) CreateConditionFromElement(e *Condition) (logging.Condition, error) CreateRuleFromElement(e *Rule) (logging.Rule, error) CreateValueFromElement(e *Value) (any, error) CreateCondition(data []byte) (logging.Condition, error) CreateRule(data []byte) (logging.Rule, error) CreateValue(data []byte) (any, error) Evaluate(cfg *Config) error EvaluateFromData(data []byte) (*Config, error) Configure(ctx logging.Context, cfg *Config) error ConfigureWithData(ctx logging.Context, data []byte) error Copy() Registry }
func DefaultRegistry ¶
func DefaultRegistry() Registry
func NewRegistry ¶
func NewRegistry() Registry
type Rule ¶
func ConditionalRule ¶
type Value ¶
func GenericValue ¶
func GenericValue(v interface{}) Value
Click to show internal directories.
Click to hide internal directories.