Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BooleanTokens = []BooleanToken{And, Or, Not}
BooleanTokens list every supported boolean token
var ConditionTokens = []ConditionToken{For, From, To, Between, Exists, Script, OptionalFor, Regexp, OptionalRegexp, Wildcard, OptionalWildcard}
ConditionTokens list every supported condition token
var DimensionTokens = []DimensionToken{By, Histogram, DateHistogram}
DimensionTokens list every supported dimension token
var IntentTokens = []IntentToken{Count, Sum, Avg, Min, Max, Select}
IntentTokens list every supported intent token
Functions ¶
This section is empty.
Types ¶
type BooleanFragment ¶
type BooleanFragment struct { Operator BooleanToken `json:"operator"` Expression string `json:"expression,omitempty"` Fragments []ConditionFragment `json:"fragments"` }
BooleanFragment is a fragment type allowing to combine multiple condition fragment with a boolean operator
func GetBooleanFragment ¶
func GetBooleanFragment(name string) (*BooleanFragment, error)
GetBooleanFragment search and return a boolean fragment by it's name
func (*BooleanFragment) IsValid ¶
func (frag *BooleanFragment) IsValid() (bool, error)
IsValid checks if an boolean fragment is valid and has no missing mandatory fields * Operator must not be empty (or 0 value) * Fragments must not be nil or empty
type BooleanToken ¶
type BooleanToken int
BooleanToken enumeration for boolean tokens
const ( // And boolean token And BooleanToken = iota + 1 // Or boolean token Or // Not boolean token Not // If boolean token If )
func GetBooleanToken ¶
func GetBooleanToken(name string) *BooleanToken
GetBooleanToken search and return a boolean token from the standard supported operator list
func (BooleanToken) MarshalJSON ¶
func (s BooleanToken) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (BooleanToken) String ¶
func (s BooleanToken) String() string
func (*BooleanToken) UnmarshalJSON ¶
func (s *BooleanToken) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type ConditionFragment ¶
ConditionFragment is an interface for condition fragment (which can be boolean or leafcondition)
type ConditionToken ¶
type ConditionToken int
ConditionToken enumeration for condition tokens
const ( // For condition token For ConditionToken = iota + 1 // From condition token From // To condition token To // Between condition token Between // Exists condition token Exists // Script condition token Script // OptionalFor condition token OptionalFor // Regexp condition token Regexp // OptionalRegexp condition token OptionalRegexp // Wildcard condition token Wildcard // OptionalWildcard condition token OptionalWildcard )
func GetConditionToken ¶
func GetConditionToken(name string) *ConditionToken
GetConditionToken search and return a condition token from the standard supported operator list
func (ConditionToken) MarshalJSON ¶
func (s ConditionToken) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (ConditionToken) String ¶
func (s ConditionToken) String() string
func (*ConditionToken) UnmarshalJSON ¶
func (s *ConditionToken) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type ConditionsAlias ¶
type ConditionsAlias struct { Condition ConditionFragment `json:"condition,omitempty"` Comment string `json:"comment"` }
ConditionsAlias ...
type DimensionFragment ¶
type DimensionFragment struct { Name string `json:"name,omitempty"` Operator DimensionToken `json:"operator"` Term string `json:"term"` Size int `json:"size,omitempty"` Interval float64 `json:"interval,omitempty"` DateInterval string `json:"dateinterval,omitempty"` CalendarFixed bool `json:"calendarfixed,omitempty"` TimeZone string `json:"timezone,omitempty"` }
DimensionFragment is a fragment type which contains a single dimension definition
func GetDimensionFragment ¶
func GetDimensionFragment(name string) (*DimensionFragment, error)
GetDimensionFragment search and return a dimension fragment by its name
func (*DimensionFragment) IsValid ¶
func (frag *DimensionFragment) IsValid() (bool, error)
IsValid checks if an intent fragment is valid and has no missing mandatory fields * Operator must not be empty (or 0 value) * Term must not be empty * Size must not be lesser than 0 * Interval must not be lesser than 0
type DimensionToken ¶
type DimensionToken int
DimensionToken enumeration for dimension tokens
const ( // By dimension token By DimensionToken = iota + 1 // Histogram dimension token Histogram // DateHistogram dimension token DateHistogram )
func GetDimensionToken ¶
func GetDimensionToken(name string) *DimensionToken
GetDimensionToken search and return a dimension token from the standard supported operator list
func (DimensionToken) MarshalJSON ¶
func (s DimensionToken) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (DimensionToken) String ¶
func (s DimensionToken) String() string
func (*DimensionToken) UnmarshalJSON ¶
func (s *DimensionToken) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type Fact ¶
type Fact struct { ID int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` IsObject bool `json:"isObject"` Model string `json:"model"` CalculationDepth int64 `json:"calculationDepth,omitempty"` Intent *IntentFragment `json:"intent,omitempty"` Dimensions []*DimensionFragment `json:"dimensions,omitempty"` Condition ConditionFragment `json:"condition,omitempty"` Restitution []Restitution `json:"restitution,omitempty"` Comment string `json:"comment"` AdvancedSource string `json:"source,omitempty"` IsTemplate bool `json:"isTemplate"` Variables []string `json:"variables,omitempty"` }
Fact is the main structure used to for the full fact definition
func (*Fact) ContextualizeCondition ¶
ContextualizeCondition contextualize fact condition tree placeholders (standard or custom) and set the right timezone if needed
func (*Fact) ContextualizeDimensions ¶
ContextualizeDimensions contextualize fact dimensions placeholders (standard or custom) and set the right timezone if needed
func (*Fact) IsExecutable ¶
IsExecutable check if a fact is complete and executable
func (*Fact) IsValid ¶
IsValid checks if a fact definition is valid and has no missing mandatory fields * Name must not be empty * CalculationDepth must not be less than 0 * Intent must be valid * Dimensions must be valid * Condition must be valid
func (*Fact) UnmarshalJSON ¶
UnmarshalJSON unmarshal a fact from a json string
type IntentFragment ¶
type IntentFragment struct { Name string `json:"name,omitempty"` Operator IntentToken `json:"operator"` Term string `json:"term"` Script bool `json:"script,omitempty"` }
IntentFragment is a fragment type which contains a single intent definition
func GetIntentFragment ¶
func GetIntentFragment(name string) (*IntentFragment, error)
GetIntentFragment search and return an intent fragment by it's name
func (*IntentFragment) IsValid ¶
func (frag *IntentFragment) IsValid() (bool, error)
IsValid checks if an intent fragment is valid and has no missing mandatory fields * Operator must not be empty (or 0 value) * Term must not be empty
type IntentToken ¶
type IntentToken int
IntentToken enumeration for intent tokens
const ( // Count intent token Count IntentToken = iota + 1 // Sum intent token Sum // Avg intent token Avg // Min intent token Min // Max intent token Max // Select intent token Select )
func GetIntentToken ¶
func GetIntentToken(name string) *IntentToken
GetIntentToken search and return an intent token from the standard supported operator list
func (IntentToken) MarshalJSON ¶
func (s IntentToken) MarshalJSON() ([]byte, error)
MarshalJSON marshals the enum as a quoted json string
func (IntentToken) String ¶
func (s IntentToken) String() string
func (*IntentToken) UnmarshalJSON ¶
func (s *IntentToken) UnmarshalJSON(b []byte) error
UnmarshalJSON unmashals a quoted json string to the enum value
type LeafConditionFragment ¶
type LeafConditionFragment struct { Operator ConditionToken `json:"operator"` Field string `json:"term"` Value interface{} `json:"value,omitempty"` Value2 interface{} `json:"value2,omitempty"` TimeZone string `json:"timezone,omitempty"` }
LeafConditionFragment is a fragment containing a single terminal condition
func GetLeafConditionFragment ¶
func GetLeafConditionFragment(name string) (*LeafConditionFragment, error)
GetLeafConditionFragment search and return a leaf condition fragment by it's name
func (*LeafConditionFragment) IsValid ¶
func (frag *LeafConditionFragment) IsValid() (bool, error)
IsValid checks if a leaf condition fragment is valid and has no missing mandatory fields * Operator must not be empty (or 0 value) * Fragments must not be nil or empty