Documentation ¶
Index ¶
- Variables
- func NewOperationError(left, right reflect.Value, operator string) error
- type ADDExprExecutor
- type ANDExprExecutor
- type BinaryExprExecutor
- type BoolOperator
- type COMMENTExprExecutor
- type ComplexOperator
- type EQLExprExecutor
- type FloatOperator
- type GEQExprExecutor
- type GTRExprExecutor
- type GenericOperator
- type IntOperator
- type InvalidTypeOperator
- type LANDExprExecutor
- type LEQExprExecutor
- type LORExprExecutor
- type LPARENExprExecutor
- type LSSExprExecutor
- type MULExprExecutor
- type NEQExprExecutor
- type NOTExprExecutor
- type ORExprExecutor
- type OperationError
- type Operator
- type OperatorExecutor
- type OperatorExpr
- type QUOExprExecutor
- type REMExprExecutor
- type RPARENExprExecutor
- type SUBExprExecutor
- type StringOperator
- type UintOperator
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedBinaryExpr = errors.New("unsupported binary expression")
ErrUnsupportedBinaryExpr is the error that the binary expression is unsupported
Functions ¶
Types ¶
type BinaryExprExecutor ¶
type BinaryExprExecutor interface { // Exec execute the binary expression // right is the right value of the binary expression // next is the function to get the left value of the binary expression // return the result of the binary expression Exec(x, y func() (reflect.Value, error)) (reflect.Value, error) }
BinaryExprExecutor is the interface for binary expression executor
type BoolOperator ¶
type BoolOperator struct {
OperatorExpr
}
BoolOperator represents a boolean operator. It embeds OperatorExpr to inherit its methods.
type COMMENTExprExecutor ¶
type COMMENTExprExecutor struct{}
type ComplexOperator ¶
type ComplexOperator struct {
OperatorExpr
}
ComplexOperator represents a complex operator. It embeds OperatorExpr to inherit its methods.
type FloatOperator ¶
type FloatOperator struct {
OperatorExpr
}
FloatOperator represents a float operator. It embeds OperatorExpr to inherit its methods.
type GenericOperator ¶
type GenericOperator struct {
OperatorExpr
}
GenericOperator represents a generic operator. It embeds OperatorExpr to inherit its methods.
type IntOperator ¶
type IntOperator struct {
OperatorExpr
}
IntOperator represents an integer operator. It embeds OperatorExpr to inherit its methods.
type InvalidTypeOperator ¶
type InvalidTypeOperator struct {
OperatorExpr
}
InvalidTypeOperator represents a type operator. It embeds OperatorExpr to inherit its methods.
type OperationError ¶
type OperationError struct {
// contains filtered or unexported fields
}
OperationError represents an operation error between two values. It contains the left and right values that caused the error, and the operator that was being applied.
func (OperationError) Error ¶
func (c OperationError) Error() string
Error method implements the error interface. It returns a string describing the error.
type Operator ¶
type Operator interface { // Operate performs an operation between two values. Operate(left, right reflect.Value) (reflect.Value, error) }
Operator defines an interface for operators. It has a single method, Operate, which performs an operation between two values.
type OperatorExecutor ¶
type OperatorExecutor struct {
Operator
}
OperatorExecutor is the executor for operator
type OperatorExpr ¶
type OperatorExpr int
OperatorExpr represents an operator expression. It is an integer type that represents different types of operators.
const ( Add OperatorExpr = iota // + Sub // - Mul // * Quo // / Rem // % And // & Land // && Or // | Lor // || Eq // == Ne // != Lt // < Le // <= Gt // > Ge // >= )
func (OperatorExpr) String ¶
func (e OperatorExpr) String() string
String method returns the string representation of the operator.
type RPARENExprExecutor ¶
type RPARENExprExecutor struct{}
RPARENExprExecutor is the executor for ) it just return the value
type StringOperator ¶
type StringOperator struct {
OperatorExpr
}
StringOperator represents a string operator. It embeds OperatorExpr to inherit its methods.
type UintOperator ¶
type UintOperator struct {
OperatorExpr
}
UintOperator represents an unsigned integer operator. It embeds OperatorExpr to inherit its methods.