testutils

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 7 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func A1Shape

func A1Shape() shape.Shape

func A1ToJSON

func A1ToJSON(x *A1) ([]byte, error)

func AlphabetShape

func AlphabetShape() shape.Shape

func AlphabetToJSON

func AlphabetToJSON(x Alphabet) ([]byte, error)

func B2Shape

func B2Shape() shape.Shape

func B2ToJSON

func B2ToJSON(x *B2) ([]byte, error)

func BranchShape

func BranchShape() shape.Shape

func BranchToJSON

func BranchToJSON(x *Branch) ([]byte, error)

func C3Shape

func C3Shape() shape.Shape

func C3ToJSON

func C3ToJSON(x *C3) ([]byte, error)

func KShape

func KShape() shape.Shape

func KToJSON

func KToJSON(x *K) ([]byte, error)

func KaShape added in v1.21.0

func KaShape() shape.Shape

func KaToJSON added in v1.21.0

func KaToJSON(x *Ka) ([]byte, error)

func LaShape added in v1.21.0

func LaShape() shape.Shape

func LaToJSON added in v1.21.0

func LaToJSON(x *La) ([]byte, error)

func LeafShape

func LeafShape() shape.Shape

func LeafToJSON

func LeafToJSON(x *Leaf) ([]byte, error)

func MaShape added in v1.21.0

func MaShape() shape.Shape

func MaToJSON added in v1.21.0

func MaToJSON(x *Ma) ([]byte, error)

func MatchAlphabet

func MatchAlphabet[TOut any](
	x Alphabet,
	f1 func(x *A1) TOut,
	f2 func(x *B2) TOut,
	f3 func(x *C3) TOut,
	df func(x Alphabet) TOut,
) TOut

func MatchAlphabetNumberTupleR0

func MatchAlphabetNumberTupleR0[T0 Alphabet, T1 Number](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0),
	f1 func(x0 *C3, x1 any),
	f2 func(x0 any, x1 any),
)

func MatchAlphabetNumberTupleR1

func MatchAlphabetNumberTupleR1[T0 Alphabet, T1 Number, TOut1 any](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0) TOut1,
	f1 func(x0 *C3, x1 any) TOut1,
	f2 func(x0 any, x1 any) TOut1,
) TOut1

func MatchAlphabetNumberTupleR2

func MatchAlphabetNumberTupleR2[T0 Alphabet, T1 Number, TOut1 any, TOut2 any](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0) (TOut1, TOut2),
	f1 func(x0 *C3, x1 any) (TOut1, TOut2),
	f2 func(x0 any, x1 any) (TOut1, TOut2),
) (TOut1, TOut2)

func MatchAlphabetNumberTupleR3

func MatchAlphabetNumberTupleR3[T0 Alphabet, T1 Number, TOut1 any, TOut2 any, TOut3 any](
	t0 T0,
	t1 T1,
	f0 func(x0 *A1, x1 *N0) (TOut1, TOut2, TOut3),
	f1 func(x0 *C3, x1 any) (TOut1, TOut2, TOut3),
	f2 func(x0 any, x1 any) (TOut1, TOut2, TOut3),
) (TOut1, TOut2, TOut3)

func MatchAlphabetR2

func MatchAlphabetR2[TOut1, TOut2 any](
	x Alphabet,
	f1 func(x *A1) (TOut1, TOut2),
	f2 func(x *B2) (TOut1, TOut2),
	f3 func(x *C3) (TOut1, TOut2),
	df func(x Alphabet) (TOut1, TOut2),
) (TOut1, TOut2)

func MatchNumber

func MatchNumber[TOut any](
	x Number,
	f1 func(x *N0) TOut,
	f2 func(x *N1) TOut,
	df func(x Number) TOut,
) TOut

func MatchNumberR2

func MatchNumberR2[TOut1, TOut2 any](
	x Number,
	f1 func(x *N0) (TOut1, TOut2),
	f2 func(x *N1) (TOut1, TOut2),
	df func(x Number) (TOut1, TOut2),
) (TOut1, TOut2)

func MatchTree

func MatchTree[TOut any](
	x Tree,
	f1 func(x *Branch) TOut,
	f2 func(x *Leaf) TOut,
	f3 func(x *K) TOut,
	f4 func(x *P) TOut,
	f5 func(x *Ma) TOut,
	f6 func(x *La) TOut,
	f7 func(x *Ka) TOut,
	df func(x Tree) TOut,
) TOut

func MatchTreeR2

func MatchTreeR2[TOut1, TOut2 any](
	x Tree,
	f1 func(x *Branch) (TOut1, TOut2),
	f2 func(x *Leaf) (TOut1, TOut2),
	f3 func(x *K) (TOut1, TOut2),
	f4 func(x *P) (TOut1, TOut2),
	f5 func(x *Ma) (TOut1, TOut2),
	f6 func(x *La) (TOut1, TOut2),
	f7 func(x *Ka) (TOut1, TOut2),
	df func(x Tree) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchAlphabet

func MustMatchAlphabet[TOut any](
	x Alphabet,
	f1 func(x *A1) TOut,
	f2 func(x *B2) TOut,
	f3 func(x *C3) TOut,
) TOut

func MustMatchAlphabetR0

func MustMatchAlphabetR0(
	x Alphabet,
	f1 func(x *A1),
	f2 func(x *B2),
	f3 func(x *C3),
)

func MustMatchAlphabetR2

func MustMatchAlphabetR2[TOut1, TOut2 any](
	x Alphabet,
	f1 func(x *A1) (TOut1, TOut2),
	f2 func(x *B2) (TOut1, TOut2),
	f3 func(x *C3) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchNumber

func MustMatchNumber[TOut any](
	x Number,
	f1 func(x *N0) TOut,
	f2 func(x *N1) TOut,
) TOut

func MustMatchNumberR0

func MustMatchNumberR0(
	x Number,
	f1 func(x *N0),
	f2 func(x *N1),
)

func MustMatchNumberR2

func MustMatchNumberR2[TOut1, TOut2 any](
	x Number,
	f1 func(x *N0) (TOut1, TOut2),
	f2 func(x *N1) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchTree

func MustMatchTree[TOut any](
	x Tree,
	f1 func(x *Branch) TOut,
	f2 func(x *Leaf) TOut,
	f3 func(x *K) TOut,
	f4 func(x *P) TOut,
	f5 func(x *Ma) TOut,
	f6 func(x *La) TOut,
	f7 func(x *Ka) TOut,
) TOut

func MustMatchTreeR0

func MustMatchTreeR0(
	x Tree,
	f1 func(x *Branch),
	f2 func(x *Leaf),
	f3 func(x *K),
	f4 func(x *P),
	f5 func(x *Ma),
	f6 func(x *La),
	f7 func(x *Ka),
)

func MustMatchTreeR2

func MustMatchTreeR2[TOut1, TOut2 any](
	x Tree,
	f1 func(x *Branch) (TOut1, TOut2),
	f2 func(x *Leaf) (TOut1, TOut2),
	f3 func(x *K) (TOut1, TOut2),
	f4 func(x *P) (TOut1, TOut2),
	f5 func(x *Ma) (TOut1, TOut2),
	f6 func(x *La) (TOut1, TOut2),
	f7 func(x *Ka) (TOut1, TOut2),
) (TOut1, TOut2)

func N0Shape

func N0Shape() shape.Shape

func N0ToJSON

func N0ToJSON(x *N0) ([]byte, error)

func N1Shape

func N1Shape() shape.Shape

func N1ToJSON

func N1ToJSON(x *N1) ([]byte, error)

func NumberShape

func NumberShape() shape.Shape

func NumberToJSON

func NumberToJSON(x Number) ([]byte, error)

func PShape added in v1.20.2

func PShape() shape.Shape

func PToJSON added in v1.20.2

func PToJSON(x *P) ([]byte, error)

func TreeShape

func TreeShape() shape.Shape

func TreeToJSON

func TreeToJSON(x Tree) ([]byte, error)

Types

type A1

type A1 struct{}

func A1FromJSON

func A1FromJSON(x []byte) (*A1, error)

func (*A1) AcceptAlphabet

func (r *A1) AcceptAlphabet(v AlphabetVisitor) any

func (*A1) MarshalJSON

func (r *A1) MarshalJSON() ([]byte, error)

func (*A1) UnmarshalJSON

func (r *A1) UnmarshalJSON(data []byte) error

type Alphabet

type Alphabet interface {
	AcceptAlphabet(g AlphabetVisitor) any
}

func AlphabetFromJSON

func AlphabetFromJSON(x []byte) (Alphabet, error)

type AlphabetUnionJSON

type AlphabetUnionJSON struct {
	Type string          `json:"$type,omitempty"`
	A1   json.RawMessage `json:"testutils.A1,omitempty"`
	B2   json.RawMessage `json:"testutils.B2,omitempty"`
	C3   json.RawMessage `json:"testutils.C3,omitempty"`
}

type AlphabetVisitor

type AlphabetVisitor interface {
	VisitA1(v *A1) any
	VisitB2(v *B2) any
	VisitC3(v *C3) any
}

type B2

type B2 struct{}

func B2FromJSON

func B2FromJSON(x []byte) (*B2, error)

func (*B2) AcceptAlphabet

func (r *B2) AcceptAlphabet(v AlphabetVisitor) any

func (*B2) MarshalJSON

func (r *B2) MarshalJSON() ([]byte, error)

func (*B2) UnmarshalJSON

func (r *B2) UnmarshalJSON(data []byte) error

type Branch

type Branch struct {
	Lit   Tree
	List  []Tree
	Map   map[string]Tree
	Of    *ListOf[Tree] `json:"just_of"`
	L     *Leaf
	Kattr [2]*Leaf
}

func BranchFromJSON

func BranchFromJSON(x []byte) (*Branch, error)

func (*Branch) AcceptTree

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

func (*Branch) MarshalJSON

func (r *Branch) MarshalJSON() ([]byte, error)

func (*Branch) UnmarshalJSON

func (r *Branch) UnmarshalJSON(data []byte) error

type C3

type C3 struct{}

func C3FromJSON

func C3FromJSON(x []byte) (*C3, error)

func (*C3) AcceptAlphabet

func (r *C3) AcceptAlphabet(v AlphabetVisitor) any

func (*C3) MarshalJSON

func (r *C3) MarshalJSON() ([]byte, error)

func (*C3) UnmarshalJSON

func (r *C3) UnmarshalJSON(data []byte) error

type K

type K string

func KFromJSON

func KFromJSON(x []byte) (*K, error)

func (*K) AcceptTree

func (r *K) AcceptTree(v TreeVisitor) any

func (*K) MarshalJSON

func (r *K) MarshalJSON() ([]byte, error)

func (*K) UnmarshalJSON

func (r *K) UnmarshalJSON(data []byte) error

type Ka added in v1.21.0

type Ka []map[string]Tree

func KaFromJSON added in v1.21.0

func KaFromJSON(x []byte) (*Ka, error)

func (*Ka) AcceptTree added in v1.21.0

func (r *Ka) AcceptTree(v TreeVisitor) any

func (*Ka) MarshalJSON added in v1.21.0

func (r *Ka) MarshalJSON() ([]byte, error)

func (*Ka) UnmarshalJSON added in v1.21.0

func (r *Ka) UnmarshalJSON(data []byte) error

type La added in v1.21.0

type La []Tree

func LaFromJSON added in v1.21.0

func LaFromJSON(x []byte) (*La, error)

func (*La) AcceptTree added in v1.21.0

func (r *La) AcceptTree(v TreeVisitor) any

func (*La) MarshalJSON added in v1.21.0

func (r *La) MarshalJSON() ([]byte, error)

func (*La) UnmarshalJSON added in v1.21.0

func (r *La) UnmarshalJSON(data []byte) error

type Leaf

type Leaf struct{ Value int64 }

func LeafFromJSON

func LeafFromJSON(x []byte) (*Leaf, error)

func (*Leaf) AcceptTree

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

func (*Leaf) MarshalJSON

func (r *Leaf) MarshalJSON() ([]byte, error)

func (*Leaf) UnmarshalJSON

func (r *Leaf) UnmarshalJSON(data []byte) error

type ListOf added in v1.20.2

type ListOf[T any] struct {
	Data T
}

type ListOf2 added in v1.20.2

type ListOf2[T1 comparable, T2 any] struct {
	ID        string
	Data      T1
	List      []T2
	Map       map[T1]T2 `json:"map_of_tree"`
	ListOf    ListOf[T1]
	ListOfPtr *ListOf[T2]
	Time      time.Time
	Value     schema.Schema
}

type Ma added in v1.21.0

type Ma map[string]Tree

func MaFromJSON added in v1.21.0

func MaFromJSON(x []byte) (*Ma, error)

func (*Ma) AcceptTree added in v1.21.0

func (r *Ma) AcceptTree(v TreeVisitor) any

func (*Ma) MarshalJSON added in v1.21.0

func (r *Ma) MarshalJSON() ([]byte, error)

func (*Ma) UnmarshalJSON added in v1.21.0

func (r *Ma) UnmarshalJSON(data []byte) error

type MatchAlphabetNumberTuple

type MatchAlphabetNumberTuple[T0 Alphabet, T1 Number] interface {
	Match1(x *A1, y *N0)
	Match2(x *C3, y any)
	Match3(x, y any)
}

type N0

type N0 struct{}

func N0FromJSON

func N0FromJSON(x []byte) (*N0, error)

func (*N0) AcceptNumber

func (r *N0) AcceptNumber(v NumberVisitor) any

func (*N0) MarshalJSON

func (r *N0) MarshalJSON() ([]byte, error)

func (*N0) UnmarshalJSON

func (r *N0) UnmarshalJSON(data []byte) error

type N1

type N1 struct{}

func N1FromJSON

func N1FromJSON(x []byte) (*N1, error)

func (*N1) AcceptNumber

func (r *N1) AcceptNumber(v NumberVisitor) any

func (*N1) MarshalJSON

func (r *N1) MarshalJSON() ([]byte, error)

func (*N1) UnmarshalJSON

func (r *N1) UnmarshalJSON(data []byte) error

type Number

type Number interface {
	AcceptNumber(g NumberVisitor) any
}

func NumberFromJSON

func NumberFromJSON(x []byte) (Number, error)

type NumberUnionJSON

type NumberUnionJSON struct {
	Type string          `json:"$type,omitempty"`
	N0   json.RawMessage `json:"testutils.N0,omitempty"`
	N1   json.RawMessage `json:"testutils.N1,omitempty"`
}

type NumberVisitor

type NumberVisitor interface {
	VisitN0(v *N0) any
	VisitN1(v *N1) any
}

type P added in v1.20.2

func PFromJSON added in v1.20.2

func PFromJSON(x []byte) (*P, error)

func (*P) AcceptTree added in v1.20.2

func (r *P) AcceptTree(v TreeVisitor) any

func (*P) MarshalJSON added in v1.21.0

func (r *P) MarshalJSON() ([]byte, error)

func (*P) UnmarshalJSON added in v1.21.0

func (r *P) UnmarshalJSON(data []byte) error

type Tree

type Tree interface {
	AcceptTree(g TreeVisitor) any
}

func TreeFromJSON

func TreeFromJSON(x []byte) (Tree, error)

type TreeUnionJSON

type TreeUnionJSON struct {
	Type   string          `json:"$type,omitempty"`
	Branch json.RawMessage `json:"testutils.Branch,omitempty"`
	Leaf   json.RawMessage `json:"testutils.Leaf,omitempty"`
	K      json.RawMessage `json:"testutils.K,omitempty"`
	P      json.RawMessage `json:"testutils.P,omitempty"`
	Ma     json.RawMessage `json:"testutils.Ma,omitempty"`
	La     json.RawMessage `json:"testutils.La,omitempty"`
	Ka     json.RawMessage `json:"testutils.Ka,omitempty"`
}

type TreeVisitor

type TreeVisitor interface {
	VisitBranch(v *Branch) any
	VisitLeaf(v *Leaf) any
	VisitK(v *K) any
	VisitP(v *P) any
	VisitMa(v *Ma) any
	VisitLa(v *La) any
	VisitKa(v *Ka) any
}

Jump to

Keyboard shortcuts

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