protoeval

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 28 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 CelEnvType = &celEnvType{}

CelEnvType is the CEL type for the protoeval environment.

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 *descriptorpb.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 *anypb.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 []*anypb.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]*anypb.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() *descriptorpb.FieldDescriptorProto

func (*Scope) GetList

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

func (*Scope) GetMap

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

func (*Scope) GetParent

func (x *Scope) GetParent() *Scope

func (*Scope) GetValue

func (x *Scope) GetValue() *anypb.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 and the scope fields.
	// 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.
	//
	// If empty, forces the creation of a new scope identical to its parent scope.
	// This can be useful in combination with argument handling.
	//
	// If non-empty, each element corresponds to a field, list element, or map
	// entry selection. A string element can select a message field by name or a
	// map entry (if the map does not have string keys, an attempt at conversion
	// will be made). A number element can select a message field by field number,
	// a list entry by index, or a map entry if the map has integer keys. It is an
	// error if the number is not losslessly convertible to the corresponding
	// integer type. A bool element can only select a map entry, and the map must
	// have boolean keys.
	Scope *structpb.ListValue `protobuf:"bytes,3,opt,name=scope,proto3" json:"scope,omitempty"`
	// value describes the actual value. If omitted, the value will be the
	// scope value.
	//
	// Types that are assignable to Value:
	//	*Value_Arg
	//	*Value_Parent
	//	*Value_Default
	//	*Value_BasicValue
	//	*Value_Int
	//	*Value_Uint
	//	*Value_Bytes
	//	*Value_Enum_
	//	*Value_List_
	//	*Value_Map_
	//	*Value_Message_
	//	*Value_BasicMessage
	//	*Value_Duration
	//	*Value_Timestamp
	//	*Value_Not
	//	*Value_AllOf
	//	*Value_AnyOf
	//	*Value_Seq
	//	*Value_Switch_
	//	*Value_While
	//	*Value_Break
	//	*Value_Continue
	//	*Value_Store
	//	*Value_Proc
	//	*Value_Load
	//	*Value_Program_
	//	*Value_Range_
	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() *anypb.Any

func (*Value) GetBasicValue added in v0.0.4

func (x *Value) GetBasicValue() *structpb.Value

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() *emptypb.Empty

func (*Value) GetDropArgs added in v0.0.2

func (x *Value) GetDropArgs() uint32

func (*Value) GetDuration

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

func (*Value) GetEnum

func (x *Value) GetEnum() *Value_Enum

func (*Value) GetInt added in v0.0.2

func (x *Value) GetInt() int64

func (*Value) GetList

func (x *Value) GetList() *Value_List

func (*Value) GetLoad

func (x *Value) GetLoad() *Value

func (*Value) GetMap

func (x *Value) GetMap() *Value_Map

func (*Value) GetMessage

func (x *Value) GetMessage() *Value_Message

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) GetRange added in v0.0.4

func (x *Value) GetRange() *Value_Range

func (*Value) GetScope

func (x *Value) GetScope() *structpb.ListValue

func (*Value) GetSeq

func (x *Value) GetSeq() *Value_ValueList

func (*Value) GetStore

func (x *Value) GetStore() *Value_StoredValue

func (*Value) GetSwitch

func (x *Value) GetSwitch() *Value_Switch

func (*Value) GetTimestamp

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

func (*Value) GetUint added in v0.0.2

func (x *Value) GetUint() 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,19,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,20,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,4,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 *anypb.Any `protobuf:"bytes,15,opt,name=basic_message,json=basicMessage,proto3,oneof"`
}

type Value_BasicValue added in v0.0.4

type Value_BasicValue struct {
	// value is an explicit basic value. A basic value is null, bool, double,
	// string, a list of basic values, or a map with string keys and basic
	// values. These are exactly the values which can be represented with JSON
	// without ancillary information (i. e., JSON numbers are all interpreted as
	// double; see the int and uint fields to create explicit integer values).
	BasicValue *structpb.Value `protobuf:"bytes,7,opt,name=basic_value,json=basicValue,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,24,opt,name=break,proto3,oneof"`
}

type Value_Bytes

type Value_Bytes struct {
	// bytes is an explicit bytes value.
	Bytes []byte `protobuf:"bytes,10,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,25,opt,name=continue,proto3,oneof"`
}

type Value_Default

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

type Value_Duration

type Value_Duration struct {
	// duration is an explicit duration.
	Duration *durationpb.Duration `protobuf:"bytes,16,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,11,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_Int added in v0.0.2

type Value_Int struct {
	// int is an explicit signed integer value.
	Int int64 `protobuf:"varint,8,opt,name=int,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. For simple lists,
	// basic_value may be a better choice.
	List *Value_List `protobuf:"bytes,12,opt,name=list,proto3,oneof"`
}

type Value_Load

type Value_Load struct {
	// load loads a value from the environment.
	// load should evaluate to a string, the key to be retrieved from the
	// enviroinment.
	// If no previous store under that key is present, the value is null.
	Load *Value `protobuf:"bytes,28,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. For simple maps,
	// basic_value may be a better choice.
	Map *Value_Map `protobuf:"bytes,13,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. For simple
	// messages, basic_message may be a better choice.
	Message *Value_Message `protobuf:"bytes,14,opt,name=message,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,18,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,5,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,27,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).
	// If code is used, lines must be empty.
	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,29,opt,name=program,proto3,oneof"`
}

type Value_Range added in v0.0.4

type Value_Range struct {

	// iterable is the iterable value ranged over. If omitted, the scope value
	// is used instead. It is an error if this value is not an aggregate.
	Iterable *Value `protobuf:"bytes,1,opt,name=iterable,proto3" json:"iterable,omitempty"`
	// value is evaluated for each element in the iterable value ranged over.
	//
	// 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 null, evaluation
	// stops early and the range yields that value. Otherwise, the range
	// yields null.
	Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

Range describes a value obtained by ranging over an aggregate, i. e., a list or a map.

func (*Value_Range) Descriptor deprecated added in v0.0.4

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

Deprecated: Use Value_Range.ProtoReflect.Descriptor instead.

func (*Value_Range) GetIterable added in v0.0.4

func (x *Value_Range) GetIterable() *Value

func (*Value_Range) GetValue added in v0.0.4

func (x *Value_Range) GetValue() *Value

func (*Value_Range) ProtoMessage added in v0.0.4

func (*Value_Range) ProtoMessage()

func (*Value_Range) ProtoReflect added in v0.0.4

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

func (*Value_Range) Reset added in v0.0.4

func (x *Value_Range) Reset()

func (*Value_Range) String added in v0.0.4

func (x *Value_Range) String() string

type Value_Range_ added in v0.0.4

type Value_Range_ struct {
	// range ranges over an aggregate value. See the Range documentation for
	// which value this yields.
	Range *Value_Range `protobuf:"bytes,30,opt,name=range,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 null.
	Seq *Value_ValueList `protobuf:"bytes,21,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,26,opt,name=store,proto3,oneof"`
}

type Value_StoredValue

type Value_StoredValue struct {

	// key is the storage key. It must evaluate to a string.
	Key *Value `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() *Value

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_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 null 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,22,opt,name=switch,proto3,oneof"`
}

type Value_Timestamp

type Value_Timestamp struct {
	// timestamp is an explicit timestamp.
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,17,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,9,opt,name=uint,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, null is returned.
	While *Value_Branch `protobuf:"bytes,23,opt,name=while,proto3,oneof"`
}

Jump to

Keyboard shortcuts

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