Documentation
¶
Index ¶
- Variables
- func GetArrayFromCondition(condition string) ([]string, error)
- func GetConditionByType(conditionFull string, conditionType ConditionType) (string, error)
- func GetConditionsAndOrFromString(in string) ([]string, bool)
- func GetGroup(s string) (string, error)
- func InterfaceFromString(in string, inType ValidatorType) (interface{}, error)
- func LookupConditionType(conType ConditionType) error
- func LookupOperator(operator Operator) error
- type AstValue
- type AstValueType
- type ConditionGroup
- type ConditionType
- type JsonMap
- type Operator
- type RootNode
- type Token
- type TokenType
- type Validation
- type ValidatorMap
- type ValidatorType
Constants ¶
This section is empty.
Variables ¶
View Source
var ValidConditionTypes = map[ConditionType]int{ NONE: 0, EQUAL: 1, NOT_EQUAL: 2, MIN_VALUE: 3, MAX_VLAUE: 4, CONTAINS: 5, NOT_CONTAINS: 6, FROM: 7, NOT_FROM: 8, REGX: 9, }
Functions ¶
func GetArrayFromCondition ¶
func GetConditionByType ¶
func GetConditionByType(conditionFull string, conditionType ConditionType) (string, error)
func InterfaceFromString ¶ added in v0.1.9
func InterfaceFromString(in string, inType ValidatorType) (interface{}, error)
func LookupConditionType ¶ added in v0.2.0
func LookupConditionType(conType ConditionType) error
LookupConditionType checks our validConditionType map for the scanned condition type. If not found, an error is returned.
func LookupOperator ¶ added in v0.2.0
LookupOperator checks our validOperator map for the scanned operator. If not found, an error is returned.
Types ¶
type AstValue ¶ added in v0.2.0
type AstValue struct {
Type AstValueType
ConditionType ConditionType
ConditionValue string
ConditionGroup ConditionGroup
Operator Operator
Start int
End int
}
AstValue holds a Type ("Condition" or "Group") as well as a `ConditionType` and `ConditionValue`. The ConditionType is a model.ConditionType and the ConditionValue is any string (numbers are also represented as string).
func (AstValue) AstConditionToString ¶ added in v0.2.0
func (AstValue) AstGroupToString ¶ added in v0.2.0
type AstValueType ¶ added in v0.2.0
type AstValueType string
const ( GROUP AstValueType = "Group" CONDITION AstValueType = "Condition" )
type ConditionGroup ¶ added in v0.2.0
type ConditionGroup []*AstValue
type ConditionType ¶ added in v0.2.0
type ConditionType string
ConditionType is the type for all available condition types.
const ( NONE ConditionType = "-" EQUAL ConditionType = "equ" NOT_EQUAL ConditionType = "neq" MIN_VALUE ConditionType = "min" MAX_VLAUE ConditionType = "max" CONTAINS ConditionType = "con" NOT_CONTAINS ConditionType = "nco" FROM ConditionType = "frm" NOT_FROM ConditionType = "nfr" REGX ConditionType = "rex" )
Available condition types.
func GetConditionType ¶
func GetConditionType(s string) (ConditionType, error)
type Operator ¶ added in v0.2.0
type Operator string
Operator is the type for all available operators.
type RootNode ¶ added in v0.2.0
type RootNode struct {
RootValue *AstValue
}
RootNode is what starts every parsed AST.
type TokenType ¶ added in v0.2.0
type TokenType string
const ( // Token/character we don't know about LexerIllegal TokenType = "ILLEGAL" // End of file LexerEOF TokenType = "EOF" // Group LexerLeftBrace TokenType = "GROUP_OPEN" LexerRightBrace TokenType = "GROUP_CLOSE" // Literals LexerConditionType TokenType = "CONDITION_TYPE" LexerConditionValue TokenType = "CONDITION_VALUE" LexerConditionValueString TokenType = "CONDITION_VALUE_STRING" // Operators LexerOperator TokenType = "OPERATOR" )
type Validation ¶
type Validation struct {
Key string
Type ValidatorType
Conditions string
}
type ValidatorMap ¶
type ValidatorMap map[string]Validation
type ValidatorType ¶
type ValidatorType string
const ( String ValidatorType = "string" Int ValidatorType = "int" Float ValidatorType = "float" Bool ValidatorType = "bool" Map ValidatorType = "map" Time ValidatorType = "time" )
func TypeFromInterface ¶ added in v0.1.9
func TypeFromInterface(in interface{}) (ValidatorType, error)
Click to show internal directories.
Click to hide internal directories.