expressions

package
v0.369.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TryResolveExpressionEarly

func TryResolveExpressionEarly(ctx context.Context, schema *proto.Schema, model *proto.Model, action *proto.Action, expression *parser.Expression, args map[string]any) (canResolveInMemory bool, resolvedValue bool)

TryResolveExpressionEarly attempts to evaluate the expression in the runtime process without generating a row-based query against the database.

Types

type OperandResolver

type OperandResolver struct {
	Context context.Context
	Schema  *proto.Schema
	Model   *proto.Model
	Action  *proto.Action
	// contains filtered or unexported fields
}

OperandResolver hides some of the complexity of expression parsing so that the runtime action code can reason about and execute expression logic without stepping through the AST.

func NewOperandResolver

func NewOperandResolver(ctx context.Context, schema *proto.Schema, model *proto.Model, action *proto.Action, operand *parser.Operand) *OperandResolver

func (*OperandResolver) GetOperandType

func (resolver *OperandResolver) GetOperandType() (proto.Type, error)

GetOperandType returns the equivalent protobuf type for the expression operand.

func (*OperandResolver) IsContextDbColumn added in v0.369.1

func (resolver *OperandResolver) IsContextDbColumn() bool

IsContextDbColumn returns true if the expression refers to a value on the context which will require database access (such as with identity backlinks), such as: @permission(expression: ctx.identity.user.isActive)

func (*OperandResolver)