fn

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvaluateFunction

func EvaluateFunction(name string, args []string, ctx Context) (value interface{}, found bool, err error)

EvaluateFunction evaluates a function by name.

Returns:

  • value: the function result
  • found: whether the function name is registered
  • err: evaluation error (only meaningful if found is true)

func Register

func Register(name string, fn Func)

Register registers a function implementation for the given name. Names are stored in lower-case.

Types

type Context

type Context struct {
	Nodes map[string]*storage.Node
	Rels  map[string]*storage.Edge

	Eval func(expr string) (interface{}, error)
	Now  func() time.Time
}

Context provides runtime access for function evaluation without importing the parent `cypher` package (avoids import cycles).

Eval must evaluate a Cypher expression in the caller's scope (row bindings). Functions can use Eval for lazy argument evaluation (e.g. coalesce).

type Func

type Func func(ctx Context, args []string) (interface{}, error)

Func evaluates a Cypher function call.

args are the raw argument expressions (not pre-evaluated). Use ctx.Eval for evaluation to preserve Cypher semantics like lazy coalesce.

Jump to

Keyboard shortcuts

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