github.com/kubeshop/testkube@v1.17.23/pkg/tcl/expressionstcl/expression.go (about) 1 // Copyright 2024 Testkube. 2 // 3 // Licensed as a Testkube Pro file under the Testkube Community 4 // License (the "License"); you may not use this file except in compliance with 5 // the License. You may obtain a copy of the License at 6 // 7 // https://github.com/kubeshop/testkube/blob/main/licenses/TCL.txt 8 9 package expressionstcl 10 11 //go:generate mockgen -destination=./mock_expression.go -package=expressionstcl "github.com/kubeshop/testkube/pkg/tcl/expressionstcl" Expression 12 type Expression interface { 13 String() string 14 SafeString() string 15 Template() string 16 Type() Type 17 SafeResolve(...Machine) (Expression, bool, error) 18 Resolve(...Machine) (Expression, error) 19 Static() StaticValue 20 Accessors() map[string]struct{} 21 Functions() map[string]struct{} 22 } 23 24 type Type string 25 26 const ( 27 TypeUnknown Type = "" 28 TypeBool Type = "bool" 29 TypeString Type = "string" 30 TypeFloat64 Type = "float64" 31 TypeInt64 Type = "int64" 32 ) 33 34 //go:generate mockgen -destination=./mock_staticvalue.go -package=expressionstcl "github.com/kubeshop/testkube/pkg/tcl/expressionstcl" StaticValue 35 type StaticValue interface { 36 Expression 37 IsNone() bool 38 IsString() bool 39 IsBool() bool 40 IsInt() bool 41 IsNumber() bool 42 IsMap() bool 43 IsSlice() bool 44 Value() interface{} 45 BoolValue() (bool, error) 46 IntValue() (int64, error) 47 FloatValue() (float64, error) 48 StringValue() (string, error) 49 MapValue() (map[string]interface{}, error) 50 SliceValue() ([]interface{}, error) 51 }