Documentation
¶
Index ¶
- func AddOperator(key string, cb func(values, data any) (result any))
- func Apply(rule, data io.Reader, result io.Writer) error
- func ApplyInterface(rule, data any) (output any, err error)
- func ApplyRaw(rule, data json.RawMessage) (json.RawMessage, error)
- func GetJsonLogicWithSolvedVars(rule, data json.RawMessage) ([]byte, error)
- func IsValid(rule io.Reader) bool
- func ValidateJsonLogic(rules any) bool
- type ErrInvalidOperator
- type ErrReduceDataType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOperator ¶ added in v3.2.0
AddOperator allows for custom operators to be used
func Apply ¶
Apply read the rule and it's data from io.Reader, executes it and write back a JSON into an io.Writer result
func ApplyInterface ¶
ApplyInterface receives a rule and data as any and returns the result of the rule applied to the data.
func ApplyRaw ¶
func ApplyRaw(rule, data json.RawMessage) (json.RawMessage, error)
ApplyRaw receives a rule and data as json.RawMessage and returns the result of the rule applied to the data.
func GetJsonLogicWithSolvedVars ¶ added in v3.3.0
func GetJsonLogicWithSolvedVars(rule, data json.RawMessage) ([]byte, error)
func ValidateJsonLogic ¶ added in v3.1.0
Types ¶
type ErrInvalidOperator ¶
type ErrInvalidOperator struct {
// contains filtered or unexported fields
}
func (ErrInvalidOperator) Error ¶
func (e ErrInvalidOperator) Error() string
type ErrReduceDataType ¶ added in v3.1.0
type ErrReduceDataType struct {
// contains filtered or unexported fields
}
func (ErrReduceDataType) Error ¶ added in v3.1.0
func (e ErrReduceDataType) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.