Documentation
¶
Index ¶
- type Rule
- type Ruler
- type RulerRule
- func (rf *RulerRule) End() *Ruler
- func (rf *RulerRule) Eq(value interface{}) *RulerRule
- func (rf *RulerRule) Gt(value interface{}) *RulerRule
- func (rf *RulerRule) Gte(value interface{}) *RulerRule
- func (rf *RulerRule) Lt(value interface{}) *RulerRule
- func (rf *RulerRule) Lte(value interface{}) *RulerRule
- func (rf *RulerRule) Matches(value interface{}) *RulerRule
- func (rf *RulerRule) Neq(value interface{}) *RulerRule
- func (rf *RulerRule) NotMatches(value interface{}) *RulerRule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
type Rule struct { Comparator string `json:"comparator"` Path string `json:"path"` Value interface{} `json:"value"` }
This struct is the main format for rules or conditions in ruler-compatable libraries. Here's a sample in JSON format:
{ "comparator": "eq", "path": "person.name", "value": "James" }
Valid comparators are: eq, neq, lt, lte, gt, gte, contains (regex), ncontains (!regex)
This struct is exported here so that you can include it in your own JSON encoding/decoding, but go-ruler has a facility to help decode your rules from JSON into its own structs.
type Ruler ¶
type Ruler struct {
// contains filtered or unexported fields
}
func NewRuler ¶
creates a new Ruler for you optionally accepts a pointer to a slice of filters if you have filters that you want to start with
func NewRulerWithJson ¶
returns a new ruler with filters parsed from JSON data expects JSON as a slice of bytes and will parse your JSON for you!
type RulerRule ¶
A RulerRule combines a single rule and a whole set of rules and is used when building rules programmatically through Ruler's Rule() function. It's not meant to be created directly.
func (*RulerRule) End ¶
Stops chaining for the current rule, allowing you to add rules for other properties
func (*RulerRule) NotMatches ¶
adds a not matches condition (ncontains, in the way this thinks of it)