Documentation
¶
Index ¶
- Variables
- func GetConstValue(expr *exprv1.Expr) (any, error)
- func GetExprValue(expr *exprv1.Expr) (any, error)
- func GetFunctionValue(expr *exprv1.Expr) (any, error)
- func GetIdentExprName(expr *exprv1.Expr) (string, error)
- func Parse(filter string, opts ...cel.EnvOption) (expr *exprv1.ParsedExpr, err error)
- type ConvertContext
Constants ¶
This section is empty.
Variables ¶
View Source
var MemoFilterCELAttributes = []cel.EnvOption{ cel.Variable("content", cel.StringType), cel.Variable("creator_id", cel.IntType), cel.Variable("created_ts", cel.IntType), cel.Variable("updated_ts", cel.IntType), cel.Variable("pinned", cel.BoolType), cel.Variable("tag", cel.StringType), cel.Variable("visibility", cel.StringType), cel.Variable("has_task_list", cel.BoolType), cel.Function("now", cel.Overload("now", []*cel.Type{}, cel.IntType, cel.FunctionBinding(func(_ ...ref.Val) ref.Val { return types.Int(time.Now().Unix()) }), ), ), }
MemoFilterCELAttributes are the CEL attributes for memo.
Functions ¶
func GetConstValue ¶
GetConstValue returns the constant value of the expression.
func GetExprValue ¶ added in v0.24.4
GetExprValue attempts to get a value from an expression, trying constants first, then functions.
func GetFunctionValue ¶ added in v0.24.4
GetFunctionValue evaluates CEL function calls and returns their value. This is specifically for time functions like now().
func GetIdentExprName ¶
GetIdentExprName returns the name of the identifier expression.
Types ¶
type ConvertContext ¶
type ConvertContext struct {
Buffer strings.Builder
Args []any
// The offset of the next argument in the condition string.
// Mainly using for PostgreSQL.
ArgsOffset int
}
func NewConvertContext ¶
func NewConvertContext() *ConvertContext
Click to show internal directories.
Click to hide internal directories.