summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/d5/tengo/v2/objects.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/d5/tengo/v2/objects.go')
-rw-r--r--vendor/github.com/d5/tengo/v2/objects.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/github.com/d5/tengo/v2/objects.go b/vendor/github.com/d5/tengo/v2/objects.go
index 27c1d493..30913db5 100644
--- a/vendor/github.com/d5/tengo/v2/objects.go
+++ b/vendor/github.com/d5/tengo/v2/objects.go
@@ -1342,6 +1342,38 @@ func (o *String) BinaryOp(op token.Token, rhs Object) (Object, error) {
}
return &String{Value: o.Value + rhsStr}, nil
}
+ case token.Less:
+ switch rhs := rhs.(type) {
+ case *String:
+ if o.Value < rhs.Value {
+ return TrueValue, nil
+ }
+ return FalseValue, nil
+ }
+ case token.LessEq:
+ switch rhs := rhs.(type) {
+ case *String:
+ if o.Value <= rhs.Value {
+ return TrueValue, nil
+ }
+ return FalseValue, nil
+ }
+ case token.Greater:
+ switch rhs := rhs.(type) {
+ case *String:
+ if o.Value > rhs.Value {
+ return TrueValue, nil
+ }
+ return FalseValue, nil
+ }
+ case token.GreaterEq:
+ switch rhs := rhs.(type) {
+ case *String:
+ if o.Value >= rhs.Value {
+ return TrueValue, nil
+ }
+ return FalseValue, nil
+ }
}
return nil, ErrInvalidOperator
}