types

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HierarchyType = cel.ObjectType(hierarchyTypeName,
		traits.IndexerType,
		traits.SizerType,
		traits.ReceiverType)

	HierarchyFunc = cel.Function(hierarchyFn,
		cel.Overload(
			fmt.Sprintf("%s_string", hierarchyFn),
			[]*cel.Type{cel.StringType},
			hierarchyCelType,
			cel.UnaryBinding(unaryHierarchyFnImpl),
		),

		cel.Overload(
			fmt.Sprintf("%s_string_string", hierarchyFn),
			[]*cel.Type{cel.StringType, cel.StringType},
			hierarchyCelType,
			cel.BinaryBinding(binaryHierarchyFnImpl),
		),

		cel.Overload(
			fmt.Sprintf("%s_stringarray", hierarchyFn),
			[]*cel.Type{cel.ListType(cel.StringType)},
			hierarchyCelType,
			cel.UnaryBinding(unaryHierarchyFnImpl),
		),
	)

	HierarchyDeclrations = []*exprpb.Decl{
		decls.NewFunction(overloadAncestorOf,
			decls.NewInstanceOverload(overloadAncestorOf,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				decls.Bool,
			),
		),

		decls.NewFunction(overloadCommonAncestors,
			decls.NewInstanceOverload(overloadCommonAncestors,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				hierarchyTypeExpr,
			),
		),

		decls.NewFunction(overloadDescendentOf,
			decls.NewInstanceOverload(overloadDescendentOf,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				decls.Bool,
			),
		),

		decls.NewFunction(overloadImmediateChildOf,
			decls.NewInstanceOverload(overloadImmediateChildOf,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				decls.Bool,
			),
		),

		decls.NewFunction(overloadImmediateParentOf,
			decls.NewInstanceOverload(overloadImmediateParentOf,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				decls.Bool,
			),
		),

		decls.NewFunction(overloadOverlaps,
			decls.NewInstanceOverload(overloadOverlaps,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				decls.Bool,
			),
		),

		decls.NewFunction(overloadSiblingOf,
			decls.NewInstanceOverload(overloadSiblingOf,
				[]*exprpb.Type{hierarchyTypeExpr, hierarchyTypeExpr},
				decls.Bool,
			),
		),

		decls.NewFunction(overloads.Size,
			decls.NewInstanceOverload(fmt.Sprintf("%s_size", hierarchyFn),
				[]*exprpb.Type{hierarchyTypeExpr},
				decls.Int,
			),
		),

		decls.NewFunction(operators.Index,
			decls.NewOverload(fmt.Sprintf("%s_index", hierarchyFn),
				[]*exprpb.Type{hierarchyTypeExpr, decls.Int},
				decls.String,
			),
		),
	}
)

Functions

This section is empty.

Types

type Hierarchy

type Hierarchy []string

Hierarchy is a type that represents a dot-separated hierarchy such as a.b.c.d.

func (Hierarchy) ConvertToNative

func (h Hierarchy) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative implements ref.Val.ConvertToNative.

func (Hierarchy) ConvertToType

func (h Hierarchy) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType implements ref.Val.ConvertToType.

func (Hierarchy) Equal

func (h Hierarchy) Equal(other ref.Val) ref.Val

Equal implements ref.Val.Equal.

func (Hierarchy) Get

func (h Hierarchy) Get(index ref.Val) ref.Val

Get implements traits.Indexer.Get.

func (Hierarchy) Receive

func (h Hierarchy) Receive(function, _ string, args []ref.Val) ref.Val

Receive implements traits.Reciever.Receive.

func (Hierarchy) Size

func (h Hierarchy) Size() ref.Val

Size implements traits.Sizer.Size.

func (Hierarchy) Type

func (h Hierarchy) Type() ref.Type

Type implements ref.Val.Type.

func (Hierarchy) Value

func (h Hierarchy) Value() any

Value implements ref.Val.Value.

type JSONFieldProvider added in v0.13.0

type JSONFieldProvider struct {
	types.Provider
}

JSONFieldProvider is a custom type provider that allows protobuf fields to be accessed by their JSON name (camel case).

func NewCamelCaseFieldProvider added in v0.13.0

func NewCamelCaseFieldProvider(tp types.Provider) *JSONFieldProvider

func (*JSONFieldProvider) FindStructFieldType added in v0.30.0

func (ccfp *JSONFieldProvider) FindStructFieldType(msgType, fieldName string) (*types.FieldType, bool)

Jump to

Keyboard shortcuts

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