example

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Code generated by mkunion. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReduceTree

func ReduceTree[A any](r TreeReducer[A], v Tree, init A) A

func ReduceVehicle

func ReduceVehicle[A any](r VehicleReducer[A], v Vehicle, init A) A

func ReduceWherePredicate

func ReduceWherePredicate[A any](r WherePredicateReducer[A], v WherePredicate, init A) A

Types

type And

type And []WherePredicate

func (*And) Accept

func (r *And) Accept(v WherePredicateVisitor) any

type Boat

type Boat struct{}

func (*Boat) Accept

func (r *Boat) Accept(v VehicleVisitor) any

type Branch

type Branch struct{ L, R Tree }

func (*Branch) Accept

func (r *Branch) Accept(v TreeVisitor) any

type Car

type Car struct{}

func (*Car) Accept

func (r *Car) Accept(v VehicleVisitor) any

type Eq

type Eq struct{ V interface{} }

func (*Eq) Accept

func (r *Eq) Accept(v WherePredicateVisitor) any

type Leaf

type Leaf struct{ Value int }

func (*Leaf) Accept

func (r *Leaf) Accept(v TreeVisitor) any

type Or

type Or []WherePredicate

func (*Or) Accept

func (r *Or) Accept(v WherePredicateVisitor) any

type Path

type Path struct {
	Parts     []string
	Condition WherePredicate
	Then      []WherePredicate
	X         Eq
}

func (*Path) Accept

func (r *Path) Accept(v WherePredicateVisitor) any

type Plane

type Plane struct{}

func (*Plane) Accept

func (r *Plane) Accept(v VehicleVisitor) any

type Tree

type Tree interface {
	Accept(g TreeVisitor) any
}

type TreeDefaultReduction

type TreeDefaultReduction[A any] struct {
	PanicOnFallback      bool
	DefaultStopReduction bool
	OnBranch             func(x *Branch, agg A) (result A, stop bool)
	OnLeaf               func(x *Leaf, agg A) (result A, stop bool)
}

func (*TreeDefaultReduction[A]) ReduceBranch

func (t *TreeDefaultReduction[A]) ReduceBranch(x *Branch, agg A) (result A, stop bool)

func (*TreeDefaultReduction[A]) ReduceLeaf

func (t *TreeDefaultReduction[A]) ReduceLeaf(x *Leaf, agg A) (result A, stop bool)

type TreeDefaultVisitor

type TreeDefaultVisitor[A any] struct {
	Default  A
	OnBranch func(x *Branch) A
	OnLeaf   func(x *Leaf) A
}

func (*TreeDefaultVisitor[A]) VisitBranch

func (t *TreeDefaultVisitor[A]) VisitBranch(v *Branch) any

func (*TreeDefaultVisitor[A]) VisitLeaf

func (t *TreeDefaultVisitor[A]) VisitLeaf(v *Leaf) any

type TreeDepthFirstVisitor

type TreeDepthFirstVisitor[A any] struct {
	// contains filtered or unexported fields
}

func (*TreeDepthFirstVisitor[A]) VisitBranch

func (d *TreeDepthFirstVisitor[A]) VisitBranch(v *Branch) any

func (*TreeDepthFirstVisitor[A]) VisitLeaf

func (d *TreeDepthFirstVisitor[A]) VisitLeaf(v *Leaf) any

type TreeOneOf

type TreeOneOf struct {
	Branch *Branch `json:",omitempty"`
	Leaf   *Leaf   `json:",omitempty"`
}

func MapTreeToOneOf

func MapTreeToOneOf(v Tree) *TreeOneOf

func (*TreeOneOf) Accept

func (r *TreeOneOf) Accept(v TreeVisitor) any

type TreeReducer

type TreeReducer[A any] interface {
	ReduceBranch(x *Branch, agg A) (result A, stop bool)
	ReduceLeaf(x *Leaf, agg A) (result A, stop bool)
}

type TreeVisitor

type TreeVisitor interface {
	VisitBranch(v *Branch) any
	VisitLeaf(v *Leaf) any
}

type Vehicle

type Vehicle interface {
	Accept(g VehicleVisitor) any
}

type VehicleDefaultReduction

type VehicleDefaultReduction[A any] struct {
	PanicOnFallback      bool
	DefaultStopReduction bool
	OnPlane              func(x *Plane, agg A) (result A, stop bool)
	OnCar                func(x *Car, agg A) (result A, stop bool)
	OnBoat               func(x *Boat, agg A) (result A, stop bool)
}

func (*VehicleDefaultReduction[A]) ReduceBoat

func (t *VehicleDefaultReduction[A]) ReduceBoat(x *Boat, agg A) (result A, stop bool)

func (*VehicleDefaultReduction[A]) ReduceCar

func (t *VehicleDefaultReduction[A]) ReduceCar(x *Car, agg A) (result A, stop bool)

func (*VehicleDefaultReduction[A]) ReducePlane

func (t *VehicleDefaultReduction[A]) ReducePlane(x *Plane, agg A) (result A, stop bool)

type VehicleDefaultVisitor

type VehicleDefaultVisitor[A any] struct {
	Default A
	OnPlane func(x *Plane) A
	OnCar   func(x *Car) A
	OnBoat  func(x *Boat) A
}

func (*VehicleDefaultVisitor[A]) VisitBoat

func (t *VehicleDefaultVisitor[A]) VisitBoat(v *Boat) any

func (*VehicleDefaultVisitor[A]) VisitCar

func (t *VehicleDefaultVisitor[A]) VisitCar(v *Car) any

func (*VehicleDefaultVisitor[A]) VisitPlane

func (t *VehicleDefaultVisitor[A]) VisitPlane(v *Plane) any

type VehicleDepthFirstVisitor

type VehicleDepthFirstVisitor[A any] struct {
	// contains filtered or unexported fields
}

func (*VehicleDepthFirstVisitor[A]) VisitBoat

func (d *VehicleDepthFirstVisitor[A]) VisitBoat(v *Boat) any

func (*VehicleDepthFirstVisitor[A]) VisitCar

func (d *VehicleDepthFirstVisitor[A]) VisitCar(v *Car) any

func (*VehicleDepthFirstVisitor[A]) VisitPlane

func (d *VehicleDepthFirstVisitor[A]) VisitPlane(v *Plane) any

type VehicleOneOf

type VehicleOneOf struct {
	Plane *Plane `json:",omitempty"`
	Car   *Car   `json:",omitempty"`
	Boat  *Boat  `json:",omitempty"`
}

func MapVehicleToOneOf

func MapVehicleToOneOf(v Vehicle) *VehicleOneOf

func (*VehicleOneOf) Accept

func (r *VehicleOneOf) Accept(v VehicleVisitor) any

type VehicleReducer

type VehicleReducer[A any] interface {
	ReducePlane(x *Plane, agg A) (result A, stop bool)
	ReduceCar(x *Car, agg A) (result A, stop bool)
	ReduceBoat(x *Boat, agg A) (result A, stop bool)
}

type VehicleVisitor

type VehicleVisitor interface {
	VisitPlane(v *Plane) any
	VisitCar(v *Car) any
	VisitBoat(v *Boat) any
}

type WherePredicate

type WherePredicate interface {
	Accept(g WherePredicateVisitor) any
}

type WherePredicateDefaultReduction

type WherePredicateDefaultReduction[A any] struct {
	PanicOnFallback      bool
	DefaultStopReduction bool
	OnEq                 func(x *Eq, agg A) (result A, stop bool)
	OnAnd                func(x *And, agg A) (result A, stop bool)
	OnOr                 func(x *Or, agg A) (result A, stop bool)
	OnPath               func(x *Path, agg A) (result A, stop bool)
}

func (*WherePredicateDefaultReduction[A]) ReduceAnd

func (t *WherePredicateDefaultReduction[A]) ReduceAnd(x *And, agg A) (result A, stop bool)

func (*WherePredicateDefaultReduction[A]) ReduceEq

func (t *WherePredicateDefaultReduction[A]) ReduceEq(x *Eq, agg A) (result A, stop bool)

func (*WherePredicateDefaultReduction[A]) ReduceOr

func (t *WherePredicateDefaultReduction[A]) ReduceOr(x *Or, agg A) (result A, stop bool)

func (*WherePredicateDefaultReduction[A]) ReducePath

func (t *WherePredicateDefaultReduction[A]) ReducePath(x *Path, agg A) (result A, stop bool)

type WherePredicateDefaultVisitor

type WherePredicateDefaultVisitor[A any] struct {
	Default A
	OnEq    func(x *Eq) A
	OnAnd   func(x *And) A
	OnOr    func(x *Or) A
	OnPath  func(x *Path) A
}

func (*WherePredicateDefaultVisitor[A]) VisitAnd

func (t *WherePredicateDefaultVisitor[A]) VisitAnd(v *And) any

func (*WherePredicateDefaultVisitor[A]) VisitEq

func (t *WherePredicateDefaultVisitor[A]) VisitEq(v *Eq) any

func (*WherePredicateDefaultVisitor[A]) VisitOr

func (t *WherePredicateDefaultVisitor[A]) VisitOr(v *Or) any

func (*WherePredicateDefaultVisitor[A]) VisitPath

func (t *WherePredicateDefaultVisitor[A]) VisitPath(v *Path) any

type WherePredicateDepthFirstVisitor

type WherePredicateDepthFirstVisitor[A any] struct {
	// contains filtered or unexported fields
}

func (*WherePredicateDepthFirstVisitor[A]) VisitAnd

func (d *WherePredicateDepthFirstVisitor[A]) VisitAnd(v *And) any

func (*WherePredicateDepthFirstVisitor[A]) VisitEq

func (d *WherePredicateDepthFirstVisitor[A]) VisitEq(v *Eq) any

func (*WherePredicateDepthFirstVisitor[A]) VisitOr

func (d *WherePredicateDepthFirstVisitor[A]) VisitOr(v *Or) any

func (*WherePredicateDepthFirstVisitor[A]) VisitPath

func (d *WherePredicateDepthFirstVisitor[A]) VisitPath(v *Path) any

type WherePredicateOneOf

type WherePredicateOneOf struct {
	Eq   *Eq   `json:",omitempty"`
	And  *And  `json:",omitempty"`
	Or   *Or   `json:",omitempty"`
	Path *Path `json:",omitempty"`
}

func MapWherePredicateToOneOf

func MapWherePredicateToOneOf(v WherePredicate) *WherePredicateOneOf

func (*WherePredicateOneOf) Accept

type WherePredicateReducer

type WherePredicateReducer[A any] interface {
	ReduceEq(x *Eq, agg A) (result A, stop bool)
	ReduceAnd(x *And, agg A) (result A, stop bool)
	ReduceOr(x *Or, agg A) (result A, stop bool)
	ReducePath(x *Path, agg A) (result A, stop bool)
}

type WherePredicateVisitor

type WherePredicateVisitor interface {
	VisitEq(v *Eq) any
	VisitAnd(v *And) any
	VisitOr(v *Or) any
	VisitPath(v *Path) any
}

Jump to

Keyboard shortcuts

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