2018-09-18 22:42:38 +02:00
|
|
|
package core
|
|
|
|
|
|
|
|
import (
|
2019-02-13 19:31:18 +02:00
|
|
|
"context"
|
2018-09-18 22:42:38 +02:00
|
|
|
"encoding/json"
|
|
|
|
)
|
|
|
|
|
2019-02-13 19:31:18 +02:00
|
|
|
type (
|
|
|
|
// Value represents an interface of
|
|
|
|
// any type that needs to be used during runtime
|
|
|
|
Value interface {
|
|
|
|
json.Marshaler
|
|
|
|
Type() Type
|
|
|
|
String() string
|
|
|
|
Compare(other Value) int64
|
|
|
|
Unwrap() interface{}
|
|
|
|
Hash() uint64
|
|
|
|
Copy() Value
|
2018-09-18 22:42:38 +02:00
|
|
|
}
|
|
|
|
|
2019-02-13 19:31:18 +02:00
|
|
|
// Getter represents an interface of
|
|
|
|
// complex types that needs to be used to read values by path.
|
|
|
|
// The interface is created to let user-defined types be used in dot notation data access.
|
|
|
|
Getter interface {
|
|
|
|
GetIn(ctx context.Context, path []Value) (Value, error)
|
2018-09-18 22:42:38 +02:00
|
|
|
}
|
|
|
|
|
2019-02-13 19:31:18 +02:00
|
|
|
// Setter represents an interface of
|
|
|
|
// complex types that needs to be used to write values by path.
|
|
|
|
// The interface is created to let user-defined types be used in dot notation assignment.
|
|
|
|
Setter interface {
|
|
|
|
SetIn(ctx context.Context, path []Value, value Value) error
|
2018-11-07 20:52:25 +02:00
|
|
|
}
|
|
|
|
|
2019-02-13 19:31:18 +02:00
|
|
|
// PairValueType is a supporting
|
|
|
|
// structure that used in validateValueTypePairs.
|
|
|
|
PairValueType struct {
|
|
|
|
Value Value
|
|
|
|
Types []Type
|
|
|
|
}
|
|
|
|
)
|