parser

package
v0.0.0-...-b7fb57f Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(query string, options ...Option) (ast.Expression, error)

Types

type Option

type Option func(*parserOpts)

func WithFunctions

func WithFunctions(fns map[ast.FunctionID]*ast.FunctionDefinition) Option

func WithParamNodes

func WithParamNodes() Option

func WithParams

func WithParams(p groq.Params) Option

func WithVersion

func WithVersion(v Version) Option

type ParseError

type ParseError interface {
	error
	Message() string
	Pos() ast.Position
}

ParseError represents an error during parsing.

type Version

type Version int
var (
	// VersionGROQ1 targets GROQ-1: https://sanity-io.github.io/GROQ/.
	VersionGROQ1 Version = 2

	// VersionLegacyGROQ targets the legacy version of GROQ implemented by Sanity.io.
	VersionLegacyGROQ Version = 1

	// Version1 is an alias for VersionLegacyGROQ.
	// Deprecated: Use VersionLegacyGROQ.
	Version1 Version = 1

	// Version2 is an alias for VersionGROQ1.
	// Deprecated: Use VersionGROQ1.
	Version2 Version = 2
)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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