walk

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSliceType

func ConvertSliceType[T, F any, TS []T, FS []F](fs FS) (TS, error)

func Cypher

func Cypher(node cypher.SyntaxNode, visitor Visitor[cypher.SyntaxNode]) error

func Generic

func Generic[E any](node E, visitor Visitor[E], cursorConstructor func(node E) (*Cursor[E], error)) error

func PgSQL

func PgSQL(node pgsql.SyntaxNode, visitor Visitor[pgsql.SyntaxNode]) error

Types

type Cursor

type Cursor[N any] struct {
	Node        N
	Branches    []N
	BranchIndex int
}

func (*Cursor[N]) AddBranches

func (s *Cursor[N]) AddBranches(branches ...N)

func (*Cursor[N]) HasNext

func (s *Cursor[N]) HasNext() bool

func (*Cursor[N]) IsFirstVisit

func (s *Cursor[N]) IsFirstVisit() bool

func (*Cursor[N]) NextBranch

func (s *Cursor[N]) NextBranch() N

func (*Cursor[N]) NumBranchesRemaining

func (s *Cursor[N]) NumBranchesRemaining() int

type Order

type Order int
const (
	OrderPrefix Order = iota
	OrderInfix
	OrderPostfix
)

type SimpleVisitorFunc

type SimpleVisitorFunc[N any] func(node N, visitorHandler VisitorHandler)

type Visitor

type Visitor[N any] interface {
	VisitorHandler

	Enter(node N)
	Visit(node N)
	Exit(node N)
}

func NewSimpleVisitor

func NewSimpleVisitor[N any](visitorFunc SimpleVisitorFunc[N]) Visitor[N]

func NewVisitor

func NewVisitor[E any]() Visitor[E]

type VisitorHandler added in v0.1.4

type VisitorHandler interface {
	Consume()
	WasConsumed() bool
	Done() bool
	Error() error
	SetDone()
	SetError(err error)
	SetErrorf(format string, args ...any)
}

func NewCancelableErrorHandler

func NewCancelableErrorHandler() VisitorHandler

Jump to

Keyboard shortcuts

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