typing

package
v0.405.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IDArray        = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeID))
	TextArray      = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeText))
	MarkdownArray  = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeMarkdown))
	NumberArray    = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeNumber))
	DecimalArray   = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeDecimal))
	BooleanArray   = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeBoolean))
	TimestampArray = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeTimestamp))
	DateArray      = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeDate))
	DurationArray  = cel.OpaqueType(fmt.Sprintf("%s[]", parser.FieldTypeDuration))
)
View Source
var (
	FunctionSum    = "SUM"
	FunctionCount  = "COUNT"
	FunctionAvg    = "AVG"
	FunctionMedian = "MEDIAN"
	FunctionMin    = "MIN"
	FunctionMax    = "MAX"
)
View Source
var (
	Role = cel.OpaqueType("_Role")
)

Functions

func MapType

func MapType(schema []*parser.AST, typeName string, isRepeated bool) (*types.Type, error)

Types

type Ident

type Ident []string

type TypeProvider

type TypeProvider struct {
	Schema []*parser.AST
	// Objects keeps track of complex object types and their fields as defined in the CEL environment, in particular: ctx, headers, secrets.
	// For example, ctx would look like this:
	//  _Context ->
	//      isAuthenticated -> Bool
	//      now				-> Timestamp
	//		identity 		-> Identity
	Objects map[string]map[string]*types.Type
}

TypeProvider supplies the CEL context with the relevant Keel types and identifiers

func NewTypeProvider

func NewTypeProvider() *TypeProvider

func (*TypeProvider) EnumValue

func (p *TypeProvider) EnumValue(enumName string) ref.Val

func (*TypeProvider) FindFieldType

func (p *TypeProvider) FindFieldType(messageType string, fieldName string) (*types.FieldType, bool)

func (*TypeProvider) FindIdent

func (p *TypeProvider) FindIdent(identName string) (ref.Val, bool)

func (*TypeProvider) FindStructFieldNames

func (p *TypeProvider) FindStructFieldNames(structType string) ([]string, bool)

func (*TypeProvider) FindStructFieldType

func (p *TypeProvider) FindStructFieldType(structType, fieldName string) (*types.FieldType, bool)

func (*TypeProvider) FindStructType

func (p *TypeProvider) FindStructType(structType string) (*types.Type, bool)

func (*TypeProvider) FindType

func (p *TypeProvider) FindType(typeName string) (*expr.Type, bool)

func (*TypeProvider) NewValue

func (p *TypeProvider) NewValue(typeName string, fields map[string]ref.Val) ref.Val

Jump to

Keyboard shortcuts

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