testasset

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: 6 Imported by: 0

Documentation

Overview

Code generated by mkunion. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EdgeShape added in v1.20.1

func EdgeShape() shape.Shape

func EdgeToJSON added in v1.20.1

func EdgeToJSON[T1 any](x *Edge[T1]) ([]byte, error)

func GraphDSLShape added in v1.20.1

func GraphDSLShape() shape.Shape

mkunion-extension:shape

func GraphDSLToJSON added in v1.20.1

func GraphDSLToJSON[T1 any](x GraphDSL[T1]) ([]byte, error)

func GraphShape added in v1.20.1

func GraphShape() shape.Shape

func GraphToJSON added in v1.20.1

func GraphToJSON[T1 any](x *Graph[T1]) ([]byte, error)

func MatchGraphDSL added in v1.20.1

func MatchGraphDSL[T1, TOut any](
	x GraphDSL[T1],
	f1 func(x *Graph[T1]) TOut,
	f2 func(x *Vertex[T1]) TOut,
	f3 func(x *Edge[T1]) TOut,
	df func(x GraphDSL[T1]) TOut,
) TOut

func MatchGraphDSLR2 added in v1.20.1

func MatchGraphDSLR2[T1, TOut1, TOut2 any](
	x GraphDSL[T1],
	f1 func(x *Graph[T1]) (TOut1, TOut2),
	f2 func(x *Vertex[T1]) (TOut1, TOut2),
	f3 func(x *Edge[T1]) (TOut1, TOut2),
	df func(x GraphDSL[T1]) (TOut1, TOut2),
) (TOut1, TOut2)

func MustMatchGraphDSL added in v1.20.1

func MustMatchGraphDSL[T1, TOut any](
	x GraphDSL[T1],
	f1 func(x *Graph[T1]) TOut,
	f2 func(x *Vertex[T1]) TOut,
	f3 func(x *Edge[T1]) TOut,
) TOut

func MustMatchGraphDSLR0 added in v1.20.1

func MustMatchGraphDSLR0[T1 any](
	x GraphDSL[T1],
	f1 func(x *Graph[T1]),
	f2 func(x *Vertex[T1]),
	f3 func(x *Edge[T1]),
)

func MustMatchGraphDSLR2 added in v1.20.1

func MustMatchGraphDSLR2[T1, TOut1, TOut2 any](
	x GraphDSL[T1],
	f1 func(x *Graph[T1]) (TOut1, TOut2),
	f2 func(x *Vertex[T1]) (TOut1, TOut2),
	f3 func(x *Edge[T1]) (TOut1, TOut2),
) (TOut1, TOut2)

func VertexShape added in v1.20.1

func VertexShape() shape.Shape

func VertexToJSON added in v1.20.1

func VertexToJSON[T1 any](x *Vertex[T1]) ([]byte, error)

Types

type A

type A struct {
	Name string `json:"name" desc:"Name of the person"`
}

type B

type B struct {
	Age int `json:"age"`
	A   *A
	T   *time.Time
}

type C

type C string

type D

type D int64

type E

type E float64

type Edge added in v1.20.1

type Edge[T any] struct {
	Weight float64
}

go:generate go run ../../../cmd/mkunion/main.go --name=GraphDSL

func EdgeFromJSON added in v1.20.1

func EdgeFromJSON[T1 any](x []byte) (*Edge[T1], error)

func (*Edge[T1]) AcceptGraphDSL added in v1.20.1

func (r *Edge[T1]) AcceptGraphDSL(v GraphDSLVisitor[T1]) any

func (*Edge[T1]) MarshalJSON added in v1.20.1

func (self *Edge[T1]) MarshalJSON() ([]byte, error)

func (*Edge[T1]) UnmarshalJSON added in v1.20.1

func (self *Edge[T1]) UnmarshalJSON(x []byte) error

type Explain

type Explain struct {
	Example Example `json:"example"`
}

type F

type F bool

type Graph added in v1.20.1

type Graph[T any] struct {
	Vertices map[string]*Vertex[T]
}

go:generate go run ../../../cmd/mkunion/main.go --name=GraphDSL

func GraphFromJSON added in v1.20.1

func GraphFromJSON[T1 any](x []byte) (*Graph[T1], error)

func (*Graph[T1]) AcceptGraphDSL added in v1.20.1

func (r *Graph[T1]) AcceptGraphDSL(v GraphDSLVisitor[T1]) any

func (*Graph[T1]) MarshalJSON added in v1.20.1

func (self *Graph[T1]) MarshalJSON() ([]byte, error)

func (*Graph[T1]) UnmarshalJSON added in v1.20.1

func (self *Graph[T1]) UnmarshalJSON(x []byte) error

type GraphDSL added in v1.20.1

type GraphDSL[T1 any] interface {
	AcceptGraphDSL(g GraphDSLVisitor[T1]) any
}

func GraphDSLFromJSON added in v1.20.1

func GraphDSLFromJSON[T1 any](x []byte) (GraphDSL[T1], error)

type GraphDSLUnionJSON added in v1.20.1

type GraphDSLUnionJSON struct {
	Type   string          `json:"$type,omitempty"`
	Graph  json.RawMessage `json:"testasset.Graph,omitempty"`
	Vertex json.RawMessage `json:"testasset.Vertex,omitempty"`
	Edge   json.RawMessage `json:"testasset.Edge,omitempty"`
}

mkunion-extension:json

type GraphDSLVisitor added in v1.20.1

type GraphDSLVisitor[T1 any] interface {
	VisitGraph(v *Graph[T1]) any
	VisitVertex(v *Vertex[T1]) any
	VisitEdge(v *Edge[T1]) any
}

type H

type H map[string]Example

type I

type I []Example

type J

type J [2]string

type K added in v1.20.2

type K A

type L added in v1.20.2

type L = List

L Example is not allowed, since Example is interface, and interface cannot have methods implemented as Visitor pattern requires

type List added in v1.20.2

type List struct{}

List is a list of elements

type ListOf added in v1.20.2

type ListOf[T any] struct{}

type ListOf2 added in v1.20.2

type ListOf2[T1, T2 any] struct {
	Data   T1
	ListOf ListOf[T1] `json:"list_of"`
}

ListOf2 is a list of 2 elements

type M added in v1.20.2

type M List

type N added in v1.20.2

type N time.Duration

type O added in v1.20.2

type O ListOf[time.Duration]

type P added in v1.20.2

type Vertex added in v1.20.1

type Vertex[T any] struct {
	Value T
	Edges []*Edge[T]
}

go:generate go run ../../../cmd/mkunion/main.go --name=GraphDSL

func VertexFromJSON added in v1.20.1

func VertexFromJSON[T1 any](x []byte) (*Vertex[T1], error)

func (*Vertex[T1]) AcceptGraphDSL added in v1.20.1

func (r *Vertex[T1]) AcceptGraphDSL(v GraphDSLVisitor[T1]) any

func (*Vertex[T1]) MarshalJSON added in v1.20.1

func (self *Vertex[T1]) MarshalJSON() ([]byte, error)

func (*Vertex[T1]) UnmarshalJSON added in v1.20.1

func (self *Vertex[T1]) UnmarshalJSON(x []byte) error

Jump to

Keyboard shortcuts

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