github.com/MontFerret/ferret@v0.18.0/pkg/runtime/core/value.go (about) 1 package core 2 3 import ( 4 "context" 5 "encoding/json" 6 ) 7 8 type ( 9 // Value represents an interface of 10 // any type that needs to be used during runtime 11 Value interface { 12 json.Marshaler 13 Type() Type 14 String() string 15 Compare(other Value) int64 16 Unwrap() interface{} 17 Hash() uint64 18 Copy() Value 19 } 20 21 // Iterable represents an interface of a value that can be iterated by using an iterator. 22 Iterable interface { 23 Iterate(ctx context.Context) (Iterator, error) 24 } 25 26 // Iterator represents an interface of a value iterator. 27 // When iterator is exhausted it must return None as a value. 28 Iterator interface { 29 Next(ctx context.Context) (value Value, key Value, err error) 30 } 31 )