dsl

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDSLQuery

func BuildDSLQuery(registry entity.Registry, input string) (*query.QueryBuilder, error)

BuildDSLQuery validates a DSL query against the app registry and returns a core query builder. Includes are validated; callers can resolve eager loading separately until relationship joins are fully generated.

Types

type DSLFilter

type DSLFilter struct {
	Field    string
	Operator string
	Value    string
}

DSLFilter is one where() predicate.

type DSLOrder

type DSLOrder struct {
	Field     string
	Direction string
}

DSLOrder is one order() clause.

type DSLQuery

type DSLQuery struct {
	Entity   string
	Filters  []DSLFilter
	Includes []string
	Orders   []DSLOrder
	Limit    int
	After    string
}

DSLQuery is the parsed representation of a GoFastr query DSL string.

func ParseDSL

func ParseDSL(input string) (DSLQuery, error)

ParseDSL parses strings like:

Post.where(status="published").include(author).order(created_at DESC).limit(10)

Results are cached by input string. The cache is bounded to 256 entries; when full, a single randomly-chosen entry is evicted (Go map iteration is randomised, so the first key returned by `range` is effectively random — this is not LRU).

Jump to

Keyboard shortcuts

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