protoeval

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 25 Imported by: 0

README

Still experimenting, nothing to see here yet…

Documentation

Index

Constants

View Source
const (
	// DefaultEvalMax is the default maximum number of sub-evaluations before
	// a call to Eval is aborted.
	DefaultEvalMax = 1000
)

Variables

View Source
var (
	Value_Kind_name = map[int32]string{
		0:  "INVALID",
		1:  "DOUBLE",
		2:  "FLOAT",
		3:  "INT64",
		4:  "UINT64",
		5:  "INT32",
		6:  "FIXED64",
		7:  "FIXED32",
		8:  "BOOL",
		9:  "STRING",
		11: "MESSAGE",
		12: "BYTES",
		13: "UINT32",
		14: "ENUM",
		15: "SFIXED32",
		16: "SFIXED64",
		17: "SINT32",
		18: "SINT64",
	}
	Value_Kind_value = map[string]int32{
		"INVALID":  0,
		"DOUBLE":   1,
		"FLOAT":    2,
		"INT64":    3,
		"UINT64":   4,
		"INT32":    5,
		"FIXED64":  6,
		"FIXED32":  7,
		"BOOL":     8,
		"STRING":   9,
		"MESSAGE":  11,
		"BYTES":    12,
		"UINT32":   13,
		"ENUM":     14,
		"SFIXED32": 15,
		"SFIXED64": 16,
		"SINT32":   17,
		"SINT64":   18,
	}
)

Enum value maps for Value_Kind.

View Source
var CelArgListType = &celArgListType{}

CelArgListType is the CEL type for an argument list.

View Source
var (
	// ErrEvalTooLong is returned when an evaluation is too complex.
	ErrEvalTooLong = errors.New("evaluation took too long")
)

Errors

View Source
var File_protoeval_value_proto protoreflect.FileDescriptor

Functions

func Eval

func Eval(
	env *Env, msg proto.Message, value *Value, args ...interface{},
) (interface{}, error)

Eval evaluates the given message within the given environment according to the specified value, with the given arguments.

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

Env describes an environment within which an evaluation can take place. Instances of this type are not safe for concurrent use. Clone your environment instead.

func NewEnv

func NewEnv() *Env

NewEnv creates a new, empty environment.

func (*Env) Clone

func (e *Env) Clone() *Env

Clone creates a copy of this environment. Note that values set with Set or through previous evaluations are copied shallowly.

func (*Env) Get

func (e *Env) Get(key string) (value interface{}, ok bool)

Get gets a value from this environment for the given key. If no such value exists, ok == false is returned.

func (*Env) Set

func (e *Env) Set(key string, value interface{}) error

Set sets a value in this environment under the given key. If there already is a value, it is overwritten. If value is nil, it is deleted instead. If the value cannot be converted to a proper CEL value, an error is returned.

func (*Env) SetEvalMax

func (e *Env) SetEvalMax(max int) *Env

SetEvalMax sets the maximum number of sub-evaluations for an Eval call with this environment. A non-positive value will cause all evaluations to fail. This environment is returned.

type Scope

type Scope struct {

	// parent is the parent scope of this scope. If omitted, this scope is the
	// root scope.
	Parent *Scope `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
	// field_descriptor describes the field leading up to the value of this Scope.
	// If omitted, this scope is the root scope.
	FieldDescriptor *descriptor.FieldDescriptorProto `protobuf:"bytes,2,opt,name=field_descriptor,json=fieldDescriptor,proto3" json:"field_descriptor,omitempty"`
	// value is the scope value for messages and scalars. For scalars, the
	// google.protobuf wrappers types will be used. Enum values will be
	// converted to google.protobuf.Int32Value.
	// CEL automatically converts the Any and wrapper types to their proper
	// message or scalar types.
	// If the scope value is not a message or a scalar, value will be omitted.
	Value *any.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// list is the scope value for lists. If the list element type is a scalar,
	// a google.protobuf wrappers type will be used.
	// CEL automatically converts the Any and wrapper types to their proper
	// message or scalar types.
	// If the scope value is not a list, list will be omitted.
	List []*any.Any `protobuf:"bytes,4,rep,name=list,proto3" json:"list,omitempty"`
	// map is the scope value for maps. If the map key type is not a string, the
	// keys will be converted to a string as follows:
	//
	//     /-----------------------------------------\
	//     | Key     | String representation of Key  |
	//     |=========|===============================|
	//     | false   | "False"                       |
	//     | true    | "True"                        |
	//     | integer | The integer as decimal string |
	//     \-----------------------------------------/
	//
	// If the map value type is a scalar, a google.protobuf wrappers type will be
	// used. CEL automatically converts the Any and wrapper types to their proper
	// message or scalar types.
	// If the scope value is not a map, map will be omitted.
	Map map[string]*any.Any `` /* 147-byte string literal not displayed */
	// contains filtered or unexported fields
}

Scope describes a scope for CEL programs. It can be used for more complex message access. The Scope message is not directly used in the Value message.

func (*Scope) Descriptor deprecated

func (*Scope) Descriptor() ([]byte, []int)

Deprecated: Use Scope.ProtoReflect.Descriptor instead.

func (*Scope) GetFieldDescriptor

func (x *Scope) GetFieldDescriptor() *descriptor.FieldDescriptorProto

func (*Scope) GetList

func (x *Scope) GetList() []*any.Any

func (*Scope) GetMap

func (x *Scope) GetMap() map[string]*any.Any

func (*Scope) GetParent

func (x *Scope) GetParent() *Scope

func (*Scope) GetValue

func (x *Scope) GetValue() *any.Any

func (*Scope) ProtoMessage

func (*Scope) ProtoMessage()

func (*Scope) ProtoReflect

func (x *Scope) ProtoReflect() protoreflect.Message

func (*Scope) Reset

func (x *Scope) Reset()

func (*Scope) String

func (x *Scope) String() string

type Value

type Value struct {

	// drop_args drops the specified number of arguments (optional). That is, if
	// drop_args = n, args 0 through n-1 are dropped and the previously n-th
	// argument becomes the 0-th argument.
	// drop_args is applied before the args field is.
	//
	// Since arguments are available only from the current scope and all
	// subscopes, explicitly dropping arguments may be unnecessary.
	DropArgs uint32 `protobuf:"varint,1,opt,name=drop_args,json=dropArgs,proto3" json:"drop_args,omitempty"`
	// args adds the specified arguments. Arguments can be accessed by a
	// zero based index. Previous arguments are shifted, e. g., if the length
	// of args is n, the previous 0-th argument becomes the n-th argument.
	// Optional.
	//
	// The args field is applied after the drop_args field and the scope
	// oneof. The arguments are available in the resulting scope and all
	// subscopes.
	Args []*Value `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"`
	// scope changes the scope relative to the current scope. If omitted, the
	// current scope remains unchanged.
	//
	// Types that are assignable to Scope:
	//	*Value_Same
	//	*Value_Name
	//	*Value_Index
	//	*Value_BoolKey
	//	*Value_UintKey
	//	*Value_IntKey
	Scope isValue_Scope `protobuf_oneof:"scope"`
	// value describes the actual value. If omitted, the value will be the
	// scope value.
	//
	// Types that are assignable to Value:
	//	*Value_Arg
	//	*Value_This
	//	*Value_Parent
	//	*Value_Default
	//	*Value_Nil
	//	*Value_Bool
	//	*Value_Int
	//	*Value_Uint
	//	*Value_Double
	//	*Value_String_
	//	*Value_Bytes
	//	*Value_Enum_
	//	*Value_List_
	//	*Value_Map_
	//	*Value_Message_
	//	*Value_BasicMessage
	//	*Value_Duration
	//	*Value_Timestamp
	//	*Value_Not
	//	*Value_AllOf
	//	*Value_AnyOf
	//	*Value_Eq
	//	*Value_Neq
	//	*Value_Seq
	//	*Value_Switch_
	//	*Value_While
	//	*Value_Break
	//	*Value_Continue
	//	*Value_Store
	//	*Value_Proc
	//	*Value_Load
	//	*Value_Program_
	//	*Value_ScopeIs
	//	*Value_ScopeHas
	//	*Value_ScopeRange
	Value isValue_Value `protobuf_oneof:"value"`
	// contains filtered or unexported fields
}

Value describes how to arrive at a value given an environment and a scope. An environment maps names to other Values and is predetermined by the user. A scope arises from how the fields in a Value are used (see their documentation). The initial scope is the protobuf message to be evaluated.

func (*Value) Descriptor deprecated

func (*Value) Descriptor() ([]byte, []int)

Deprecated: Use Value.ProtoReflect.Descriptor instead.

func (*Value) GetAllOf

func (x *Value) GetAllOf() *Value_ValueList

func (*Value) GetAnyOf

func (x *Value) GetAnyOf() *Value_ValueList

func (*Value) GetArg added in v0.0.2

func (x *Value) GetArg() uint32

func (*Value) GetArgs added in v0.0.2

func (x *Value) GetArgs() []*Value

func (*Value) GetBasicMessage

func (x *Value) GetBasicMessage() *any.Any

func (*Value) GetBool

func (x *Value) GetBool() bool

func (*Value) GetBoolKey

func (x *Value) GetBoolKey() bool

func (*Value) GetBreak

func (x *Value) GetBreak() uint32

func (*Value) GetBytes

func (x *Value) GetBytes() []byte

func (*Value) GetContinue

func (x *Value) GetContinue() uint32

func (*Value) GetDefault

func (x *Value) GetDefault() *empty.Empty

func (*Value) GetDouble

func (x *Value) GetDouble() float64

func (*Value) GetDropArgs added in v0.0.2

func (x *Value) GetDropArgs() uint32

func (*Value) GetDuration

func (x *Value) GetDuration() *duration.Duration

func (*Value) GetEnum

func (x *Value) GetEnum() *Value_Enum

func (*Value) GetEq

func (x *Value) GetEq() *Value_ValueList

func (*Value) GetIndex

func (x *Value) GetIndex() uint32

func (*Value) GetInt added in v0.0.2

func (x *Value) GetInt() int64

func (*Value) GetIntKey

func (x *Value) GetIntKey() int64

func (*Value) GetList

func (x *Value) GetList() *Value_List

func (*Value) GetLoad

func (x *Value) GetLoad() string

func (*Value) GetMap

func (x *Value) GetMap() *Value_Map

func (*Value) GetMessage

func (x *Value) GetMessage() *Value_Message

func (*Value) GetName

func (x *Value) GetName() string

func (*Value) GetNeq

func (x *Value) GetNeq() *Value_ValueList

func (*Value) GetNil

func (x *Value) GetNil() *empty.Empty

func (*Value) GetNot

func (x *Value) GetNot() *Value

func (*Value) GetParent

func (x *Value) GetParent() *Value

func (*Value) GetProc

func (x *Value) GetProc() *Value_StoredValue

func (*Value) GetProgram

func (x *Value) GetProgram() *Value_Program

func (*Value) GetSame added in v0.0.2

func (x *Value) GetSame() *empty.Empty

func (*Value) GetScope

func (m *Value) GetScope() isValue_Scope

func (*Value) GetScopeHas

func (x *Value) GetScopeHas() string

func (*Value) GetScopeIs

func (x *Value) GetScopeIs() string

func (*Value) GetScopeRange added in v0.0.2

func (x *Value) GetScopeRange() *Value

func (*Value) GetSeq

func (x *Value) GetSeq() *Value_ValueList

func (*Value) GetStore

func (x *Value) GetStore() *Value_StoredValue

func (*Value) GetString_

func (x *Value) GetString_() string

func (*Value) GetSwitch

func (x *Value) GetSwitch() *Value_Switch

func (*Value) GetThis

func (x *Value) GetThis() *Value

func (*Value) GetTimestamp

func (x *Value) GetTimestamp() *timestamp.Timestamp

func (*Value) GetUint added in v0.0.2

func (x *Value) GetUint() uint64

func (*Value) GetUintKey

func (x *Value) GetUintKey() uint64

func (*Value) GetValue

func (m *Value) GetValue() isValue_Value

func (*Value) GetWhile

func (x *Value) GetWhile() *Value_Branch

func (*Value) ProtoMessage

func (*Value) ProtoMessage()

func (*Value) ProtoReflect

func (x *Value) ProtoReflect() protoreflect.Message

func (*Value) Reset

func (x *Value) Reset()

func (*Value) String

func (x *Value) String() string

type Value_AllOf

type Value_AllOf struct {
	// all_of yields a boolean value, which is true if and only if all values
	// in the list (based on scope) are true.
	// The list is checked in order, and if a false value is encountered, the
	// remaining entries in the list are ignored.
	// It is an error if there are values which are not boolean.
	// If the list is empty, the result is true.
	AllOf *Value_ValueList `protobuf:"bytes,28,opt,name=all_of,json=allOf,proto3,oneof"`
}

type Value_AnyOf

type Value_AnyOf struct {
	// any_of yields a boolean value, and is true if and only if there is a
	// value in the list (based on scope) which is true.
	// The list is checked in order, and if a true value is encountered, the
	// remaining entries in the list are ignored.
	// It is an error if there are values which are not boolean.
	// If the list is empty, the result is false.
	AnyOf *Value_ValueList `protobuf:"bytes,29,opt,name=any_of,json=anyOf,proto3,oneof"`
}

type Value_Arg added in v0.0.2

type Value_Arg struct {
	// arg yields the numbered argument.
	Arg uint32 `protobuf:"varint,9,opt,name=arg,proto3,oneof"`
}

type Value_BasicMessage

type Value_BasicMessage struct {
	// basic_message is an explicit message value. It uses the protobuf Any
	// mechanism. While this doesn't allow complex message generation, the
	// specification of the message itself in a configuration file will be
	// less cluttered.
	BasicMessage *any.Any `protobuf:"bytes,24,opt,name=basic_message,json=basicMessage,proto3,oneof"`
}

type Value_Bool

type Value_Bool struct {
	// bool is an explicit boolean value.
	Bool bool `protobuf:"varint,14,opt,name=bool,proto3,oneof"`
}

type Value_BoolKey

type Value_BoolKey struct {
	// bool_key selects a new scope based on the given boolean key.
	//
	// If the current scope is a map and the map key kind is bool,
	// the scope is shifted to the map value for the given bool_key. It is an
	// error if no such map entry exists.
	//
	// In all other cases, use of bool_key is an error.
	BoolKey bool `protobuf:"varint,6,opt,name=bool_key,json=boolKey,proto3,oneof"`
}

type Value_Branch

type Value_Branch struct {

	// case must be a boolean value. If it is true, then will be evaluated.
	Case *Value `protobuf:"bytes,1,opt,name=case,proto3" json:"case,omitempty"`
	// then is the value of this Branch if case is true.
	Then *Value `protobuf:"bytes,2,opt,name=then,proto3" json:"then,omitempty"`
	// contains filtered or unexported fields
}

Branch describes a conditional branch.

func (*Value_Branch) Descriptor deprecated

func (*Value_Branch) Descriptor() ([]byte, []int)

Deprecated: Use Value_Branch.ProtoReflect.Descriptor instead.

func (*Value_Branch) GetCase

func (x *Value_Branch) GetCase() *Value

func (*Value_Branch) GetThen

func (x *Value_Branch) GetThen() *Value

func (*Value_Branch) ProtoMessage

func (*Value_Branch) ProtoMessage()

func (*Value_Branch) ProtoReflect

func (x *Value_Branch) ProtoReflect() protoreflect.Message

func (*Value_Branch) Reset

func (x *Value_Branch) Reset()

func (*Value_Branch) String

func (x *Value_Branch) String() string

type Value_Break

type Value_Break struct {
	// break breaks out of the given number of while evaluations.
	// while evaluations where break occurs in the conditional part do not
	// count.
	Break uint32 `protobuf:"varint,35,opt,name=break,proto3,oneof"`
}

type Value_Bytes

type Value_Bytes struct {
	// bytes is an explicit bytes value.
	Bytes []byte `protobuf:"bytes,19,opt,name=bytes,proto3,oneof"`
}

type Value_Continue

type Value_Continue struct {
	// continue continues the given nth enclosing while evaluation.
	// while evaluations where continue occurs in the conditional
	// part do not count.
	Continue uint32 `protobuf:"varint,36,opt,name=continue,proto3,oneof"`
}

type Value_Default

type Value_Default struct {
	// default is the default value for the scope.
	Default *empty.Empty `protobuf:"bytes,12,opt,name=default,proto3,oneof"`
}

type Value_Double

type Value_Double struct {
	// double is an explicit double value.
	Double float64 `protobuf:"fixed64,17,opt,name=double,proto3,oneof"`
}

type Value_Duration

type Value_Duration struct {
	// duration is an explicit duration.
	Duration *duration.Duration `protobuf:"bytes,25,opt,name=duration,proto3,oneof"`
}

type Value_Enum

type Value_Enum struct {

	// type is the full name of the enum type. Required.
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// by selects the enum value by its numeric value or by its name. Required.
	//
	// Types that are assignable to By:
	//	*Value_Enum_Number
	//	*Value_Enum_Name
	By isValue_Enum_By `protobuf_oneof:"by"`
	// contains filtered or unexported fields
}

Enum describes an enum value.

func (*Value_Enum) Descriptor deprecated

func (*Value_Enum) Descriptor() ([]byte, []int)

Deprecated: Use Value_Enum.ProtoReflect.Descriptor instead.

func (*Value_Enum) GetBy

func (m *Value_Enum) GetBy() isValue_Enum_By

func (*Value_Enum) GetName

func (x *Value_Enum) GetName() string

func (*Value_Enum) GetNumber

func (x *Value_Enum) GetNumber() int32

func (*Value_Enum) GetType

func (x *Value_Enum) GetType() string

func (*Value_Enum) ProtoMessage

func (*Value_Enum) ProtoMessage()

func (*Value_Enum) ProtoReflect

func (x *Value_Enum) ProtoReflect() protoreflect.Message

func (*Value_Enum) Reset

func (x *Value_Enum) Reset()

func (*Value_Enum) String

func (x *Value_Enum) String() string

type Value_Enum_

type Value_Enum_ struct {
	// enum is an explicit enum value.
	Enum *Value_Enum `protobuf:"bytes,20,opt,name=enum,proto3,oneof"`
}

type Value_Enum_Name

type Value_Enum_Name struct {
	// name is the name of the enum constant.
	Name string `protobuf:"bytes,3,opt,name=name,proto3,oneof"`
}

type Value_Enum_Number

type Value_Enum_Number struct {
	// number is the numeric value of the enum constant.
	Number int32 `protobuf:"varint,2,opt,name=number,proto3,oneof"`
}

type Value_Eq

type Value_Eq struct {
	// eq yields a boolean value, which is true if and only if all values in
	// the list are equal. Two NaN values are considered equal for this purpose.
	// If an element is found to be unequal to the previous elements, the
	// remaining values are ignored.
	// It is an error if the non-ignored values do not have the same type.
	// If the list is empty or has only one element, the result is true.
	Eq *Value_ValueList `protobuf:"bytes,30,opt,name=eq,proto3,oneof"`
}

type Value_Index

type Value_Index struct {
	// index selects a new scope based on the given index.
	//
	// If the current scope is a list, the scope is shifted to the list entry
	// with the given index. It is an error if the index is out of bounds.
	//
	// In all other cases, use of index is an error.
	Index uint32 `protobuf:"varint,5,opt,name=index,proto3,oneof"`
}

type Value_Int added in v0.0.2

type Value_Int struct {
	// int is an explicit signed integer value.
	Int int64 `protobuf:"varint,15,opt,name=int,proto3,oneof"`
}

type Value_IntKey

type Value_IntKey struct {
	// int_key selects a new scope based on the given signed integer key.
	//
	// If the current scope is a map and the map key kind is
	// int32, sint32, int64, sint64, sfixed32, or sfixed64, the scope is
	// shifted to the map value for the given int_key. It is an error if no
	// such map entry exists.
	IntKey int64 `protobuf:"varint,8,opt,name=int_key,json=intKey,proto3,oneof"`
}

type Value_Kind

type Value_Kind int32

Kind enumerates protobuf type kinds as in google.protobuf.FieldDescriptorProto.Type. We cannot use the latter enum because it is a proto2 type and we use proto3 syntax. The enum numbers are identical, though.

const (
	// INVALID has no counterpart in google.protobuf.FieldDescriptorProto.Type,
	// but proto3 enums must start with zero.
	Value_INVALID Value_Kind = 0
	// DOUBLE is the kind of the double type.
	Value_DOUBLE Value_Kind = 1
	// FLOAT is the kind of the float type.
	Value_FLOAT Value_Kind = 2
	// INT64 is the kind of the int64 type.
	Value_INT64 Value_Kind = 3
	// UINT64 is the kind of the uint64 type.
	Value_UINT64 Value_Kind = 4
	// INT32 is the kind of the int32 type.
	Value_INT32 Value_Kind = 5
	// FIXED64 is the kind of the fixed64 type.
	Value_FIXED64 Value_Kind = 6
	// FIXED32 is the kind of the fixed32 type.
	Value_FIXED32 Value_Kind = 7
	// BOOL is the kind of the bool type.
	Value_BOOL Value_Kind = 8
	// STRING is the kind of the string type.
	Value_STRING Value_Kind = 9
	// MESSAGE is the kind for all message types.
	Value_MESSAGE Value_Kind = 11
	// BYTES is the kind for the bytes type.
	Value_BYTES Value_Kind = 12
	// UINT32 is the kind for the uint32 type.
	Value_UINT32 Value_Kind = 13
	// ENUM is the kind for all enum types.
	Value_ENUM Value_Kind = 14
	// SFIXED32 is the kind for the sfixed32 type.
	Value_SFIXED32 Value_Kind = 15
	// SFIXED64 is the kind for the sfixed64 type.
	Value_SFIXED64 Value_Kind = 16
	// SINT32 is the kind for the sint32 type.
	Value_SINT32 Value_Kind = 17
	// SINT64 is the kind for the sint64 type.
	Value_SINT64 Value_Kind = 18
)

func (Value_Kind) Descriptor

func (Value_Kind) Descriptor() protoreflect.EnumDescriptor

func (Value_Kind) Enum

func (x Value_Kind) Enum() *Value_Kind

func (Value_Kind) EnumDescriptor deprecated

func (Value_Kind) EnumDescriptor() ([]byte, []int)

Deprecated: Use Value_Kind.Descriptor instead.

func (Value_Kind) Number

func (x Value_Kind) Number() protoreflect.EnumNumber

func (Value_Kind) String

func (x Value_Kind) String() string

func (Value_Kind) Type

type Value_List

type Value_List struct {

	// kind is the kind of the value type of the list.
	Kind Value_Kind `protobuf:"varint,1,opt,name=kind,proto3,enum=com.github.thecount.protoeval.Value_Kind" json:"kind,omitempty"`
	// type is the full name of the value type of the list.
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// values are the values in this List. Unless the list is a heterogeneous
	// CEL list, all values must have a type compatible with kind and type.
	Values []*Value `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

List describes a list value. If both kind and type are omitted, the resulting list is a heterogeneous CEL list. If kind is omitted but type is not, kind is assumed to be MESSAGE. If kind is ENUM or MESSAGE, type must not be omitted.

func (*Value_List) Descriptor deprecated

func (*Value_List) Descriptor() ([]byte, []int)

Deprecated: Use Value_List.ProtoReflect.Descriptor instead.

func (*Value_List) GetKind

func (x *Value_List) GetKind() Value_Kind

func (*Value_List) GetType

func (x *Value_List) GetType() string

func (*Value_List) GetValues

func (x *Value_List) GetValues() []*Value

func (*Value_List) ProtoMessage

func (*Value_List) ProtoMessage()

func (*Value_List) ProtoReflect

func (x *Value_List) ProtoReflect() protoreflect.Message

func (*Value_List) Reset

func (x *Value_List) Reset()

func (*Value_List) String

func (x *Value_List) String() string

type Value_List_

type Value_List_ struct {
	// list is an explicit list value based on scope.
	List *Value_List `protobuf:"bytes,21,opt,name=list,proto3,oneof"`
}

type Value_Load

type Value_Load struct {
	// load loads a value from the environment.
	// If no previous store is present, the value is nil.
	Load string `protobuf:"bytes,39,opt,name=load,proto3,oneof"`
}

type Value_Map

type Value_Map struct {

	// key_kind is the kind of the key type of the map.
	// Must be a valid kind for a map key type.
	// Can be omitted, see above.
	KeyKind Value_Kind `` /* 129-byte string literal not displayed */
	// value_kind is the kind of the value type of the map.
	ValueKind Value_Kind `` /* 135-byte string literal not displayed */
	// value_type is the full name of the value type of the map.
	ValueType string `protobuf:"bytes,3,opt,name=value_type,json=valueType,proto3" json:"value_type,omitempty"`
	// entries is the list of map entries. The keys must be mutually distinct.
	// Keys and values must match the types determined by
	// key_kind/value_kind/value_type as described above.
	Entries []*Value_Map_Entry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"`
	// contains filtered or unexported fields
}

Map describes a map value. If key_kind is omitted, all key types allowed for protobuf maps (string, bool, and the integer types) are permitted for keys. If value_kind and value_type are both omitted, the resulting map can have heterogeneous values. If value_kind is omitted but value_type is not, value_kind is assumed to be MESSAGE. If value_kind is ENUM or MESSAGE, value_type must not be omitted.

func (*Value_Map) Descriptor deprecated

func (*Value_Map) Descriptor() ([]byte, []int)

Deprecated: Use Value_Map.ProtoReflect.Descriptor instead.

func (*Value_Map) GetEntries

func (x *Value_Map) GetEntries() []*Value_Map_Entry

func (*Value_Map) GetKeyKind

func (x *Value_Map) GetKeyKind() Value_Kind

func (*Value_Map) GetValueKind

func (x *Value_Map) GetValueKind() Value_Kind

func (*Value_Map) GetValueType

func (x *Value_Map) GetValueType() string

func (*Value_Map) ProtoMessage

func (*Value_Map) ProtoMessage()

func (*Value_Map) ProtoReflect

func (x *Value_Map) ProtoReflect() protoreflect.Message

func (*Value_Map) Reset

func (x *Value_Map) Reset()

func (*Value_Map) String

func (x *Value_Map) String() string

type Value_Map_

type Value_Map_ struct {
	// map is an explicit map value based on scope.
	Map *Value_Map `protobuf:"bytes,22,opt,name=map,proto3,oneof"`
}

type Value_Map_Entry

type Value_Map_Entry struct {

	// key is the the of this entry. Required.
	Key *Value `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// value is the value of this entry. Required.
	Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Entry describes a map entry.

func (*Value_Map_Entry) Descriptor deprecated

func (*Value_Map_Entry) Descriptor() ([]byte, []int)

Deprecated: Use Value_Map_Entry.ProtoReflect.Descriptor instead.

func (*Value_Map_Entry) GetKey

func (x *Value_Map_Entry) GetKey() *Value

func (*Value_Map_Entry) GetValue

func (x *Value_Map_Entry) GetValue() *Value

func (*Value_Map_Entry) ProtoMessage

func (*Value_Map_Entry) ProtoMessage()

func (*Value_Map_Entry) ProtoReflect

func (x *Value_Map_Entry) ProtoReflect() protoreflect.Message

func (*Value_Map_Entry) Reset

func (x *Value_Map_Entry) Reset()

func (*Value_Map_Entry) String

func (x *Value_Map_Entry) String() string

type Value_Message

type Value_Message struct {

	// type is the full name of the message type. Required.
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// fields describes the message fields. The types of the values must match
	// the message field types.
	Fields map[string]*Value `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

Message describes a message value.

func (*Value_Message) Descriptor deprecated

func (*Value_Message) Descriptor() ([]byte, []int)

Deprecated: Use Value_Message.ProtoReflect.Descriptor instead.

func (*Value_Message) GetFields

func (x *Value_Message) GetFields() map[string]*Value

func (*Value_Message) GetType

func (x *Value_Message) GetType() string

func (*Value_Message) ProtoMessage

func (*Value_Message) ProtoMessage()

func (*Value_Message) ProtoReflect

func (x *Value_Message) ProtoReflect() protoreflect.Message

func (*Value_Message) Reset

func (x *Value_Message) Reset()

func (*Value_Message) String

func (x *Value_Message) String() string

type Value_Message_

type Value_Message_ struct {
	// message is an explicit message value based on scope.
	Message *Value_Message `protobuf:"bytes,23,opt,name=message,proto3,oneof"`
}

type Value_Name

type Value_Name struct {
	// name selects a new scope based on the given name.
	//
	// If the current scope is of message kind with non-repeated cardinality,
	// the scope is shifted to the field of the given name. It is an error if
	// no such field exists.
	//
	// If the current scope is a map and the map key kind is string,
	// the scope is shifted to the map value for the given name as key. It is an
	// error if no such map entry exists.
	//
	// In all other cases, use of name is an error.
	Name string `protobuf:"bytes,4,opt,name=name,proto3,oneof"`
}

type Value_Neq

type Value_Neq struct {
	// neq yields a boolean value, which is true if and only if all values
	// in the list are mutually distinct. Two NaN values are not considered
	// distinct for this purpose.
	// If an element is found to be equal to one of the previous elements, the
	// remaining values are ignored.
	// It is an error if the non-ignored values do not have the same type.
	// If the list is empty or has only one element, the result is true.
	Neq *Value_ValueList `protobuf:"bytes,31,opt,name=neq,proto3,oneof"`
}

type Value_Nil

type Value_Nil struct {
	// nil is an explicit nil value.
	Nil *empty.Empty `protobuf:"bytes,13,opt,name=nil,proto3,oneof"`
}

type Value_Not

type Value_Not struct {
	// not yields a boolean value which is the inverse of the specified value
	// based on scope. It is an error if the specified value is not boolean.
	Not *Value `protobuf:"bytes,27,opt,name=not,proto3,oneof"`
}

type Value_Parent

type Value_Parent struct {
	// parent is a value based on the parent scope. It can be used to backtrack
	// from the current scope.
	Parent *Value `protobuf:"bytes,11,opt,name=parent,proto3,oneof"`
}

type Value_Proc

type Value_Proc struct {
	// proc stores the value in the environment.
	// Only when loaded, the value will be evaluated with the then valid
	// environment and scope.
	Proc *Value_StoredValue `protobuf:"bytes,38,opt,name=proc,proto3,oneof"`
}

type Value_Program

type Value_Program struct {

	// code is the program code, unless lines is used.
	// If lines is used, code must be empty.
	Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
	// lines are the lines of code. The program code is derived from the lines
	// by concatenating them with newline characters between them. This is
	// a convenience feature for protobuf representations which don't have
	// easily human readable multiline strings (namely JSON).
	Lines []string `protobuf:"bytes,2,rep,name=lines,proto3" json:"lines,omitempty"`
	// contains filtered or unexported fields
}

Program describes a CEL program.

func (*Value_Program) Descriptor deprecated added in v0.0.3

func (*Value_Program) Descriptor() ([]byte, []int)

Deprecated: Use Value_Program.ProtoReflect.Descriptor instead.

func (*Value_Program) GetCode added in v0.0.3

func (x *Value_Program) GetCode() string

func (*Value_Program) GetLines added in v0.0.3

func (x *Value_Program) GetLines() []string

func (*Value_Program) ProtoMessage added in v0.0.3

func (*Value_Program) ProtoMessage()

func (*Value_Program) ProtoReflect added in v0.0.3

func (x *Value_Program) ProtoReflect() protoreflect.Message

func (*Value_Program) Reset added in v0.0.3

func (x *Value_Program) Reset()

func (*Value_Program) String added in v0.0.3

func (x *Value_Program) String() string

type Value_Program_ added in v0.0.3

type Value_Program_ struct {
	// program is a user defined program to determine the value.
	Program *Value_Program `protobuf:"bytes,40,opt,name=program,proto3,oneof"`
}

type Value_Same added in v0.0.2

type Value_Same struct {
	// same forces the creation of a new scope identical to its parent scope.
	// This can be useful in combination with argument handling.
	Same *empty.Empty `protobuf:"bytes,3,opt,name=same,proto3,oneof"`
}

type Value_ScopeHas

type Value_ScopeHas struct {
	// scope_has yields a boolean value and this value is true if and only if
	// one of the following conditions holds:
	//
	// 1. The scope value is a message, has a field with the specified name, and
	// the field is set. Fields that cannot distinguish being unset from a
	// zero value are always considered set.
	//
	// 2. The scope value is a message, has a oneof with the specified name, and
	// one of the oneof fields is set.
	//
	// 3. The scope value is a map with string keys, and the map has a value
	// under the given key.
	ScopeHas string `protobuf:"bytes,42,opt,name=scope_has,json=scopeHas,proto3,oneof"`
}

type Value_ScopeIs

type Value_ScopeIs struct {
	// scope_is yields a boolean value and is true if and only if the
	// given string matches a *full* field or type name (e. g.,
	// google.protobuf.Timestamp but not Timestamp alone),
	// as defined below (more than one can apply):
	//
	// If the scope value is a message, the message type name.
	//
	// If the scope value is a map, the type name of the synthetic message
	// type generated to represent the map. See
	// https://developers.google.com/protocol-buffers/docs/proto3#backwards_compatibility
	// for details.
	//
	// If the scope value is an enum number, both the enum name and
	// the enum value name.
	//
	// If the scope is not the root scope, the field name.
	// Lists and list elements share the same field name (of a repeated field).
	// Remember that map values use a synthetic field name, see
	// https://developers.google.com/protocol-buffers/docs/proto3#backwards_compatibility.
	ScopeIs string `protobuf:"bytes,41,opt,name=scope_is,json=scopeIs,proto3,oneof"`
}

type Value_ScopeRange added in v0.0.2

type Value_ScopeRange struct {
	// scope_range ranges over the iterable scope value, evaluating the Value
	// for each element. It is an error if the current scope value is not an
	// aggregate, i. e., not a list or a map.
	//
	// Two arguments will be added before each evaluation, and
	// removed after each evaluation: for a list, the 0-th argument is the zero
	// based list index, the 1st argument is the list value. For a map, the 0-th
	// argument is the map key, and the 1st argument is the map value.
	//
	// A list will be evaluated in order. The evaluation order for a map is
	// unspecified.
	//
	// If an evaluation yields a value other than nil, evaluation
	// stops early and scope_range yields that value. Otherwise, scope_range
	// yields nil.
	ScopeRange *Value `protobuf:"bytes,43,opt,name=scope_range,json=scopeRange,proto3,oneof"`
}

type Value_Seq

type Value_Seq struct {
	// seq yields the value of last evaluated element in the list (based on
	// scope). This is normally the final element, but occurrences of break
	// or continue may cut the evaluation short. If no elements are evaluated,
	// seq yields nil.
	Seq *Value_ValueList `protobuf:"bytes,32,opt,name=seq,proto3,oneof"`
}

type Value_Store

type Value_Store struct {
	// store stores the evaluated value in the environment.
	// The completely evaluated value can be retrieved again with load.
	Store *Value_StoredValue `protobuf:"bytes,37,opt,name=store,proto3,oneof"`
}

type Value_StoredValue

type Value_StoredValue struct {

	// key is the storage key.
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// value is the value stored under key.
	Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

StoredValue describes a value stored in the environment.

func (*Value_StoredValue) Descriptor deprecated

func (*Value_StoredValue) Descriptor() ([]byte, []int)

Deprecated: Use Value_StoredValue.ProtoReflect.Descriptor instead.

func (*Value_StoredValue) GetKey

func (x *Value_StoredValue) GetKey() string

func (*Value_StoredValue) GetValue

func (x *Value_StoredValue) GetValue() *Value

func (*Value_StoredValue) ProtoMessage

func (*Value_StoredValue) ProtoMessage()

func (*Value_StoredValue) ProtoReflect

func (x *Value_StoredValue) ProtoReflect() protoreflect.Message

func (*Value_StoredValue) Reset

func (x *Value_StoredValue) Reset()

func (*Value_StoredValue) String

func (x *Value_StoredValue) String() string

type Value_String_

type Value_String_ struct {
	// string is an explicit string value.
	String_ string `protobuf:"bytes,18,opt,name=string,proto3,oneof"`
}

type Value_Switch

type Value_Switch struct {

	// cases is the list of cases. The list will be evaluated in order. The
	// first case which matches determines the then value of this Switch.
	// If no case matches, the default value is returned.
	Cases []*Value_Branch `protobuf:"bytes,1,rep,name=cases,proto3" json:"cases,omitempty"`
	// default is the value returned if none of the cases matches.
	// If default is omitted, the value will be nil in this case.
	Default *Value `protobuf:"bytes,2,opt,name=default,proto3" json:"default,omitempty"`
	// contains filtered or unexported fields
}

Switch describes a value selection by condition.

func (*Value_Switch) Descriptor deprecated

func (*Value_Switch) Descriptor() ([]byte, []int)

Deprecated: Use Value_Switch.ProtoReflect.Descriptor instead.

func (*Value_Switch) GetCases

func (x *Value_Switch) GetCases() []*Value_Branch

func (*Value_Switch) GetDefault

func (x *Value_Switch) GetDefault() *Value

func (*Value_Switch) ProtoMessage

func (*Value_Switch) ProtoMessage()

func (*Value_Switch) ProtoReflect

func (x *Value_Switch) ProtoReflect() protoreflect.Message

func (*Value_Switch) Reset

func (x *Value_Switch) Reset()

func (*Value_Switch) String

func (x *Value_Switch) String() string

type Value_Switch_

type Value_Switch_ struct {
	// switch yields a value (based on scope) based on conditions.
	Switch *Value_Switch `protobuf:"bytes,33,opt,name=switch,proto3,oneof"`
}

type Value_This

type Value_This struct {
	// this is a value based on scope. It can be used to chain multiple scope
	// shifts.
	This *Value `protobuf:"bytes,10,opt,name=this,proto3,oneof"`
}

type Value_Timestamp

type Value_Timestamp struct {
	// timestamp is an explicit timestamp.
	Timestamp *timestamp.Timestamp `protobuf:"bytes,26,opt,name=timestamp,proto3,oneof"`
}

type Value_Uint added in v0.0.2

type Value_Uint struct {
	// uint is an explicit unsigned integer value.
	Uint uint64 `protobuf:"varint,16,opt,name=uint,proto3,oneof"`
}

type Value_UintKey

type Value_UintKey struct {
	// uint_key selects a new scope based on the given unsigned integer key.
	//
	// If the current scope is a map and the map key kind is
	// uint32, uint64, fixed32, or fixed64, the scope is shifted to
	// the map value for the given uint_key. It is an error if no such map
	// entry exists.
	UintKey uint64 `protobuf:"varint,7,opt,name=uint_key,json=uintKey,proto3,oneof"`
}

type Value_ValueList

type Value_ValueList struct {

	// values is the list of values.
	Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

ValueList is a list of values, not necessarily of the same type (though users of ValueList often prescribe certain type constraints).

func (*Value_ValueList) Descriptor deprecated

func (*Value_ValueList) Descriptor() ([]byte, []int)

Deprecated: Use Value_ValueList.ProtoReflect.Descriptor instead.

func (*Value_ValueList) GetValues

func (x *Value_ValueList) GetValues() []*Value

func (*Value_ValueList) ProtoMessage

func (*Value_ValueList) ProtoMessage()

func (*Value_ValueList) ProtoReflect

func (x *Value_ValueList) ProtoReflect() protoreflect.Message

func (*Value_ValueList) Reset

func (x *Value_ValueList) Reset()

func (*Value_ValueList) String

func (x *Value_ValueList) String() string

type Value_While

type Value_While struct {
	// while repeatedly evaluates the then part of the branch for as long
	// as the case yields true. The final value from then is returned.
	// If then is never evaluated, nil is returned.
	While *Value_Branch `protobuf:"bytes,34,opt,name=while,proto3,oneof"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL