Documentation ¶
Overview ¶
Code generated by mkunion. DO NOT EDIT.
Code generated by mkunion. DO NOT EDIT.
Index ¶
- func GuardSchemaDef() *schema.UnionVariants[Guard]
- func InjectPkgName(pkgImportName, pkgName string) func(x Shape)
- func MatchGuard[TOut any](x Guard, f1 func(x *Regexp) TOut, f2 func(x *Between) TOut, ...) TOut
- func MatchGuardR2[TOut1, TOut2 any](x Guard, f1 func(x *Regexp) (TOut1, TOut2), f2 func(x *Between) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MatchShape[TOut any](x Shape, f1 func(x *Any) TOut, f2 func(x *RefName) TOut, ...) TOut
- func MatchShapeR2[TOut1, TOut2 any](x Shape, f1 func(x *Any) (TOut1, TOut2), f2 func(x *RefName) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MustMatchGuard[TOut any](x Guard, f1 func(x *Regexp) TOut, f2 func(x *Between) TOut, ...) TOut
- func MustMatchGuardR0(x Guard, f1 func(x *Regexp), f2 func(x *Between), f3 func(x *AndGuard), ...)
- func MustMatchGuardR2[TOut1, TOut2 any](x Guard, f1 func(x *Regexp) (TOut1, TOut2), f2 func(x *Between) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MustMatchShape[TOut any](x Shape, f1 func(x *Any) TOut, f2 func(x *RefName) TOut, ...) TOut
- func MustMatchShapeR0(x Shape, f1 func(x *Any), f2 func(x *RefName), f3 func(x *BooleanLike), ...)
- func MustMatchShapeR2[TOut1, TOut2 any](x Shape, f1 func(x *Any) (TOut1, TOut2), f2 func(x *RefName) (TOut1, TOut2), ...) (TOut1, TOut2)
- func ShapeSchemaDef() *schema.UnionVariants[Shape]
- func ToStr(x Shape) string
- func ToTypeScript(x Shape, option *TypeScriptOptions) string
- type AndGuard
- type Any
- type Between
- type BooleanLike
- type FieldLike
- type Guard
- type GuardVisitor
- type ListLike
- type MapLike
- type NumberLike
- type OrGuard
- type RefName
- type Regexp
- type Shape
- type ShapeVisitor
- type StringLike
- type StructLike
- type TypeScriptOptions
- type TypeScriptRenderer
- type UnionLike
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GuardSchemaDef ¶
func GuardSchemaDef() *schema.UnionVariants[Guard]
func InjectPkgName ¶
func MatchGuard ¶
func MatchGuardR2 ¶
func MatchShape ¶
func MatchShape[TOut any]( x Shape, f1 func(x *Any) TOut, f2 func(x *RefName) TOut, f3 func(x *BooleanLike) TOut, f4 func(x *StringLike) TOut, f5 func(x *NumberLike) TOut, f6 func(x *ListLike) TOut, f7 func(x *MapLike) TOut, f8 func(x *StructLike) TOut, f9 func(x *UnionLike) TOut, df func(x Shape) TOut, ) TOut
func MatchShapeR2 ¶
func MatchShapeR2[TOut1, TOut2 any]( x Shape, f1 func(x *Any) (TOut1, TOut2), f2 func(x *RefName) (TOut1, TOut2), f3 func(x *BooleanLike) (TOut1, TOut2), f4 func(x *StringLike) (TOut1, TOut2), f5 func(x *NumberLike) (TOut1, TOut2), f6 func(x *ListLike) (TOut1, TOut2), f7 func(x *MapLike) (TOut1, TOut2), f8 func(x *StructLike) (TOut1, TOut2), f9 func(x *UnionLike) (TOut1, TOut2), df func(x Shape) (TOut1, TOut2), ) (TOut1, TOut2)
func MustMatchGuard ¶
func MustMatchGuardR0 ¶
func MustMatchGuardR2 ¶
func MustMatchShape ¶
func MustMatchShape[TOut any]( x Shape, f1 func(x *Any) TOut, f2 func(x *RefName) TOut, f3 func(x *BooleanLike) TOut, f4 func(x *StringLike) TOut, f5 func(x *NumberLike) TOut, f6 func(x *ListLike) TOut, f7 func(x *MapLike) TOut, f8 func(x *StructLike) TOut, f9 func(x *UnionLike) TOut, ) TOut
func MustMatchShapeR0 ¶
func MustMatchShapeR0( x Shape, f1 func(x *Any), f2 func(x *RefName), f3 func(x *BooleanLike), f4 func(x *StringLike), f5 func(x *NumberLike), f6 func(x *ListLike), f7 func(x *MapLike), f8 func(x *StructLike), f9 func(x *UnionLike), )
func MustMatchShapeR2 ¶
func MustMatchShapeR2[TOut1, TOut2 any]( x Shape, f1 func(x *Any) (TOut1, TOut2), f2 func(x *RefName) (TOut1, TOut2), f3 func(x *BooleanLike) (TOut1, TOut2), f4 func(x *StringLike) (TOut1, TOut2), f5 func(x *NumberLike) (TOut1, TOut2), f6 func(x *ListLike) (TOut1, TOut2), f7 func(x *MapLike) (TOut1, TOut2), f8 func(x *StructLike) (TOut1, TOut2), f9 func(x *UnionLike) (TOut1, TOut2), ) (TOut1, TOut2)
func ShapeSchemaDef ¶
func ShapeSchemaDef() *schema.UnionVariants[Shape]
func ToTypeScript ¶
func ToTypeScript(x Shape, option *TypeScriptOptions) string
Types ¶
type AndGuard ¶
type AndGuard struct {
L []Guard
}
func (*AndGuard) AcceptGuard ¶
func (r *AndGuard) AcceptGuard(v GuardVisitor) any
type Any ¶
type Any struct{}
func (*Any) AcceptShape ¶
func (r *Any) AcceptShape(v ShapeVisitor) any
type Between ¶
func (*Between) AcceptGuard ¶
func (r *Between) AcceptGuard(v GuardVisitor) any
type BooleanLike ¶
type BooleanLike struct{}
func (*BooleanLike) AcceptShape ¶
func (r *BooleanLike) AcceptShape(v ShapeVisitor) any
type Guard ¶
type Guard interface {
AcceptGuard(g GuardVisitor) any
}
type GuardVisitor ¶
type ListLike ¶
type ListLike struct { //Extend *ListLike //Guard Guard Element Shape }
func (*ListLike) AcceptShape ¶
func (r *ListLike) AcceptShape(v ShapeVisitor) any
type MapLike ¶
func (*MapLike) AcceptShape ¶
func (r *MapLike) AcceptShape(v ShapeVisitor) any
type NumberLike ¶
type NumberLike struct { }
func (*NumberLike) AcceptShape ¶
func (r *NumberLike) AcceptShape(v ShapeVisitor) any
type OrGuard ¶
type OrGuard struct {
L []Guard
}
func (*OrGuard) AcceptGuard ¶
func (r *OrGuard) AcceptGuard(v GuardVisitor) any
type RefName ¶
func (*RefName) AcceptShape ¶
func (r *RefName) AcceptShape(v ShapeVisitor) any
type Regexp ¶
type Regexp struct {
Regexp string
}
func (*Regexp) AcceptGuard ¶
func (r *Regexp) AcceptGuard(v GuardVisitor) any
type Shape ¶
type Shape interface {
AcceptShape(g ShapeVisitor) any
}
type ShapeVisitor ¶
type ShapeVisitor interface { VisitAny(v *Any) any VisitRefName(v *RefName) any VisitBooleanLike(v *BooleanLike) any VisitStringLike(v *StringLike) any VisitNumberLike(v *NumberLike) any VisitListLike(v *ListLike) any VisitMapLike(v *MapLike) any VisitStructLike(v *StructLike) any VisitUnionLike(v *UnionLike) any }
type StringLike ¶
type StringLike struct { }
func (*StringLike) AcceptShape ¶
func (r *StringLike) AcceptShape(v ShapeVisitor) any
type StructLike ¶
func (*StructLike) AcceptShape ¶
func (r *StructLike) AcceptShape(v ShapeVisitor) any
type TypeScriptOptions ¶
type TypeScriptOptions struct {
// contains filtered or unexported fields
}
func (*TypeScriptOptions) IsCurrentPkgName ¶
func (o *TypeScriptOptions) IsCurrentPkgName(pkgName string) bool
func (*TypeScriptOptions) NeedsToImportPkgName ¶
func (o *TypeScriptOptions) NeedsToImportPkgName(pkg packageName, imp packageImportName)
type TypeScriptRenderer ¶
type TypeScriptRenderer struct {
// contains filtered or unexported fields
}
func NewTypeScriptRenderer ¶
func NewTypeScriptRenderer() *TypeScriptRenderer
func (*TypeScriptRenderer) AddStruct ¶
func (r *TypeScriptRenderer) AddStruct(like *StructLike)
func (*TypeScriptRenderer) AddUnion ¶
func (r *TypeScriptRenderer) AddUnion(x *UnionLike)
func (*TypeScriptRenderer) WriteToDir ¶
func (r *TypeScriptRenderer) WriteToDir(dir string) error
Click to show internal directories.
Click to hide internal directories.