Documentation ¶
Index ¶
Constants ¶
const ( // AssocLeft is the left associativity AssocLeft = 0 // AssocRight is the right associativity AssocRight = 1 )
Variables ¶
This section is empty.
Functions ¶
func IsOperator ¶
IsOperator checks if a given literal is associated with a registered operator and returns true is that is the case
Types ¶
type ApplierFunc ¶
ApplierFunc represents the function that is performed by an operator, taking a variable number of inputs as gjson.Result and returning again a gjson.Result
type OperandTypeError ¶
type OperandTypeError struct {
// contains filtered or unexported fields
}
OperandTypeError is an error that indicates a wrong type of input variable given into an operation
This error is caused by the user of the library and shall therefore be passed up to the CLI
type Operator ¶
type Operator struct { Identifier string Sign string Associativity int Precedence int ArgTypes []json.Type Apply ApplierFunc }
Operator is a function with the given name *Identifier*, that is performed on input values whenever *OperatorSign* is between them (infix). The input arguments of that function have to be of the types specified in *ArgTypes*. The precedence of the operator is defined in the corresponding attribute, with 1 being the lowest precedence (usually the select operator). The actual function is included in *Apply*.
The types of input arguments is checked before calling the function thus it can be assumed without further type checking that input arguments to the ApplierFunc are of the necessary types.
func GetOperator ¶
GetOperator returns the operator for a given literal or nil if there is no registered operator with the given sign