github.com/expr-lang/expr@v1.16.9/vm/utils.go (about) 1 package vm 2 3 import ( 4 "reflect" 5 "time" 6 ) 7 8 type ( 9 Function = func(params ...any) (any, error) 10 SafeFunction = func(params ...any) (any, uint, error) 11 ) 12 13 var ( 14 // MemoryBudget represents an upper limit of memory usage. 15 MemoryBudget uint = 1e6 16 17 errorType = reflect.TypeOf((*error)(nil)).Elem() 18 ) 19 20 type Scope struct { 21 Array reflect.Value 22 Index int 23 Len int 24 Count int 25 Acc any 26 } 27 28 type groupBy = map[any][]any 29 30 type Span struct { 31 Name string `json:"name"` 32 Expression string `json:"expression"` 33 Duration int64 `json:"duration"` 34 Children []*Span `json:"children"` 35 start time.Time 36 } 37 38 func GetSpan(program *Program) *Span { 39 return program.span 40 }