exprlang

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package exprlang is bisql's built-in expression evaluator for directive expressions (the e in /*%if e*/, the bind expression in /* e */, and so on).

It is a thin wrapper around github.com/expr-lang/expr, the de-facto Go expression language: safe, bytecode-compiled, and rich (property/method access, comparisons, boolean logic, nil checks, the "in" operator, len/collection helpers, optional chaining a?.b, nil-coalescing ??). Compiled programs are cached per expression string.

Note on syntax vs. Komapper: expressions live inside SQL comments and are never sent to the database, so their syntax has no bearing on the 2-way (runnable-as-is) property. The one visible difference from Komapper's Kotlin-flavored language is that the null literal is written "nil" (expr-lang's spelling), not "null". Callers who need a different expression dialect can plug a custom evaluator via bisql.WithEvaluator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

type Default struct {
	// contains filtered or unexported fields
}

Default is bisql's built-in evaluator. It satisfies expr.Evaluator.

The zero value is ready to use and safe for concurrent use.

func (*Default) Eval

func (d *Default) Eval(expression string, scope expr.Scope) (any, error)

Eval evaluates expression against scope and returns the resulting Go value.

Jump to

Keyboard shortcuts

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