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.
Index ¶
- func MustMatchSchema[TOut any](x Schema, f1 func(x *None) TOut, f2 func(x *Bool) TOut, ...) TOut
- func MustMatchSchemaR2[TOut1, TOut2 any](x Schema, f1 func(x *None) (TOut1, TOut2), f2 func(x *Bool) (TOut1, TOut2), ...) (TOut1, TOut2)
- func ReduceSchemaBreadthFirst[A any](r SchemaReducer[A], v Schema, init A) A
- func ReduceSchemaDepthFirst[A any](r SchemaReducer[A], v Schema, init A) A
- func RegisterRules(xs []RuleMatcher)
- func RegisterTransformations(xs []TransformFunc)
- func ToGo(x Schema, rules ...RuleMatcher) any
- func ToJSON(schema Schema) ([]byte, error)
- func UseStruct(t any) func() Setter
- type Bool
- type Field
- type List
- type Map
- type NativeList
- type NativeMap
- type None
- type Number
- type Registry
- type RuleMatcher
- type Schema
- type SchemaBreadthFirstVisitor
- func (d *SchemaBreadthFirstVisitor[A]) VisitBool(v *Bool) any
- func (d *SchemaBreadthFirstVisitor[A]) VisitList(v *List) any
- func (d *SchemaBreadthFirstVisitor[A]) VisitMap(v *Map) any
- func (d *SchemaBreadthFirstVisitor[A]) VisitNone(v *None) any
- func (d *SchemaBreadthFirstVisitor[A]) VisitNumber(v *Number) any
- func (d *SchemaBreadthFirstVisitor[A]) VisitString(v *String) any
- type SchemaDefaultReduction
- func (t *SchemaDefaultReduction[A]) ReduceBool(x *Bool, agg A) (result A, stop bool)
- func (t *SchemaDefaultReduction[A]) ReduceList(x *List, agg A) (result A, stop bool)
- func (t *SchemaDefaultReduction[A]) ReduceMap(x *Map, agg A) (result A, stop bool)
- func (t *SchemaDefaultReduction[A]) ReduceNone(x *None, agg A) (result A, stop bool)
- func (t *SchemaDefaultReduction[A]) ReduceNumber(x *Number, agg A) (result A, stop bool)
- func (t *SchemaDefaultReduction[A]) ReduceString(x *String, agg A) (result A, stop bool)
- type SchemaDefaultVisitor
- func (t *SchemaDefaultVisitor[A]) VisitBool(v *Bool) any
- func (t *SchemaDefaultVisitor[A]) VisitList(v *List) any
- func (t *SchemaDefaultVisitor[A]) VisitMap(v *Map) any
- func (t *SchemaDefaultVisitor[A]) VisitNone(v *None) any
- func (t *SchemaDefaultVisitor[A]) VisitNumber(v *Number) any
- func (t *SchemaDefaultVisitor[A]) VisitString(v *String) any
- type SchemaDepthFirstVisitor
- func (d *SchemaDepthFirstVisitor[A]) VisitBool(v *Bool) any
- func (d *SchemaDepthFirstVisitor[A]) VisitList(v *List) any
- func (d *SchemaDepthFirstVisitor[A]) VisitMap(v *Map) any
- func (d *SchemaDepthFirstVisitor[A]) VisitNone(v *None) any
- func (d *SchemaDepthFirstVisitor[A]) VisitNumber(v *Number) any
- func (d *SchemaDepthFirstVisitor[A]) VisitString(v *String) any
- type SchemaReducer
- type SchemaVisitor
- type Setter
- type String
- type StructSetter
- type TransformFunc
- type WhenField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustMatchSchema ¶ added in v1.7.3
func MustMatchSchemaR2 ¶ added in v1.7.3
func ReduceSchemaBreadthFirst ¶ added in v1.7.3
func ReduceSchemaBreadthFirst[A any](r SchemaReducer[A], v Schema, init A) A
func ReduceSchemaDepthFirst ¶ added in v1.7.3
func ReduceSchemaDepthFirst[A any](r SchemaReducer[A], v Schema, init A) A
func RegisterRules ¶ added in v1.7.2
func RegisterRules(xs []RuleMatcher)
func RegisterTransformations ¶ added in v1.7.2
func RegisterTransformations(xs []TransformFunc)
func ToGo ¶ added in v1.7.2
func ToGo(x Schema, rules ...RuleMatcher) any
Types ¶
type Bool ¶
type Bool bool
func (*Bool) Accept ¶ added in v1.7.3
func (r *Bool) Accept(v SchemaVisitor) any
type List ¶
type List struct {
Items []Schema
}
func (*List) Accept ¶ added in v1.7.3
func (r *List) Accept(v SchemaVisitor) any
type Map ¶
type Map struct {
Field []Field
}
func (*Map) Accept ¶ added in v1.7.3
func (r *Map) Accept(v SchemaVisitor) any
type NativeList ¶
type NativeList struct {
// contains filtered or unexported fields
}
func (*NativeList) Get ¶
func (s *NativeList) Get() any
type None ¶
type None struct{}
func (*None) Accept ¶ added in v1.7.3
func (r *None) Accept(v SchemaVisitor) any
type Number ¶
type Number float64
func (*Number) Accept ¶ added in v1.7.3
func (r *Number) Accept(v SchemaVisitor) any
type Registry ¶ added in v1.7.2
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶ added in v1.7.2
func NewRegistry() *Registry
func (*Registry) RegisterRules ¶ added in v1.7.2
func (r *Registry) RegisterRules(xs []RuleMatcher)
func (*Registry) RegisterTransformations ¶ added in v1.7.2
func (r *Registry) RegisterTransformations(xs []TransformFunc)
type RuleMatcher ¶
type RuleMatcher interface { MatchPath(path []any, x Schema) (Setter, bool) UnwrapField(x *Map) (Schema, bool, string) }
func FewRules ¶ added in v1.7.2
func FewRules(xs ...[]RuleMatcher) []RuleMatcher
type Schema ¶ added in v1.7.3
type Schema interface {
Accept(g SchemaVisitor) any
}
func FromGo ¶ added in v1.7.3
func FromGo(x any, transformations ...TransformFunc) Schema
type SchemaBreadthFirstVisitor ¶ added in v1.7.3
type SchemaBreadthFirstVisitor[A any] struct { // contains filtered or unexported fields }
func (*SchemaBreadthFirstVisitor[A]) VisitBool ¶ added in v1.7.3
func (d *SchemaBreadthFirstVisitor[A]) VisitBool(v *Bool) any
func (*SchemaBreadthFirstVisitor[A]) VisitList ¶ added in v1.7.3
func (d *SchemaBreadthFirstVisitor[A]) VisitList(v *List) any
func (*SchemaBreadthFirstVisitor[A]) VisitMap ¶ added in v1.7.3
func (d *SchemaBreadthFirstVisitor[A]) VisitMap(v *Map) any
func (*SchemaBreadthFirstVisitor[A]) VisitNone ¶ added in v1.7.3
func (d *SchemaBreadthFirstVisitor[A]) VisitNone(v *None) any
func (*SchemaBreadthFirstVisitor[A]) VisitNumber ¶ added in v1.7.3
func (d *SchemaBreadthFirstVisitor[A]) VisitNumber(v *Number) any
func (*SchemaBreadthFirstVisitor[A]) VisitString ¶ added in v1.7.3
func (d *SchemaBreadthFirstVisitor[A]) VisitString(v *String) any
type SchemaDefaultReduction ¶ added in v1.7.3
type SchemaDefaultReduction[A any] struct { PanicOnFallback bool DefaultStopReduction bool OnNone func(x *None, agg A) (result A, stop bool) OnBool func(x *Bool, agg A) (result A, stop bool) OnNumber func(x *Number, agg A) (result A, stop bool) OnString func(x *String, agg A) (result A, stop bool) OnList func(x *List, agg A) (result A, stop bool) OnMap func(x *Map, agg A) (result A, stop bool) }
func (*SchemaDefaultReduction[A]) ReduceBool ¶ added in v1.7.3
func (t *SchemaDefaultReduction[A]) ReduceBool(x *Bool, agg A) (result A, stop bool)
func (*SchemaDefaultReduction[A]) ReduceList ¶ added in v1.7.3
func (t *SchemaDefaultReduction[A]) ReduceList(x *List, agg A) (result A, stop bool)
func (*SchemaDefaultReduction[A]) ReduceMap ¶ added in v1.7.3
func (t *SchemaDefaultReduction[A]) ReduceMap(x *Map, agg A) (result A, stop bool)
func (*SchemaDefaultReduction[A]) ReduceNone ¶ added in v1.7.3
func (t *SchemaDefaultReduction[A]) ReduceNone(x *None, agg A) (result A, stop bool)
func (*SchemaDefaultReduction[A]) ReduceNumber ¶ added in v1.7.3
func (t *SchemaDefaultReduction[A]) ReduceNumber(x *Number, agg A) (result A, stop bool)
func (*SchemaDefaultReduction[A]) ReduceString ¶ added in v1.7.3
func (t *SchemaDefaultReduction[A]) ReduceString(x *String, agg A) (result A, stop bool)
type SchemaDefaultVisitor ¶ added in v1.7.3
type SchemaDefaultVisitor[A any] struct { Default A OnNone func(x *None) A OnBool func(x *Bool) A OnNumber func(x *Number) A OnString func(x *String) A OnList func(x *List) A OnMap func(x *Map) A }
func (*SchemaDefaultVisitor[A]) VisitBool ¶ added in v1.7.3
func (t *SchemaDefaultVisitor[A]) VisitBool(v *Bool) any
func (*SchemaDefaultVisitor[A]) VisitList ¶ added in v1.7.3
func (t *SchemaDefaultVisitor[A]) VisitList(v *List) any
func (*SchemaDefaultVisitor[A]) VisitMap ¶ added in v1.7.3
func (t *SchemaDefaultVisitor[A]) VisitMap(v *Map) any
func (*SchemaDefaultVisitor[A]) VisitNone ¶ added in v1.7.3
func (t *SchemaDefaultVisitor[A]) VisitNone(v *None) any
func (*SchemaDefaultVisitor[A]) VisitNumber ¶ added in v1.7.3
func (t *SchemaDefaultVisitor[A]) VisitNumber(v *Number) any
func (*SchemaDefaultVisitor[A]) VisitString ¶ added in v1.7.3
func (t *SchemaDefaultVisitor[A]) VisitString(v *String) any
type SchemaDepthFirstVisitor ¶ added in v1.7.3
type SchemaDepthFirstVisitor[A any] struct { // contains filtered or unexported fields }
func (*SchemaDepthFirstVisitor[A]) VisitBool ¶ added in v1.7.3
func (d *SchemaDepthFirstVisitor[A]) VisitBool(v *Bool) any
func (*SchemaDepthFirstVisitor[A]) VisitList ¶ added in v1.7.3
func (d *SchemaDepthFirstVisitor[A]) VisitList(v *List) any
func (*SchemaDepthFirstVisitor[A]) VisitMap ¶ added in v1.7.3
func (d *SchemaDepthFirstVisitor[A]) VisitMap(v *Map) any
func (*SchemaDepthFirstVisitor[A]) VisitNone ¶ added in v1.7.3
func (d *SchemaDepthFirstVisitor[A]) VisitNone(v *None) any
func (*SchemaDepthFirstVisitor[A]) VisitNumber ¶ added in v1.7.3
func (d *SchemaDepthFirstVisitor[A]) VisitNumber(v *Number) any
func (*SchemaDepthFirstVisitor[A]) VisitString ¶ added in v1.7.3
func (d *SchemaDepthFirstVisitor[A]) VisitString(v *String) any
type SchemaReducer ¶ added in v1.7.3
type SchemaReducer[A any] interface { ReduceNone(x *None, agg A) (result A, stop bool) ReduceBool(x *Bool, agg A) (result A, stop bool) ReduceNumber(x *Number, agg A) (result A, stop bool) ReduceString(x *String, agg A) (result A, stop bool) ReduceList(x *List, agg A) (result A, stop bool) ReduceMap(x *Map, agg A) (result A, stop bool) }
type SchemaVisitor ¶ added in v1.7.3
type String ¶
type String string
func (*String) Accept ¶ added in v1.7.3
func (r *String) Accept(v SchemaVisitor) any
type StructSetter ¶
type StructSetter struct {
// contains filtered or unexported fields
}
func (*StructSetter) Get ¶
func (s *StructSetter) Get() any
type TransformFunc ¶ added in v1.7.2
func FewTransformations ¶ added in v1.7.2
func FewTransformations(xs ...[]TransformFunc) []TransformFunc
func WrapStruct ¶ added in v1.7.2
func WrapStruct[A any](structt A, inField string) TransformFunc
Click to show internal directories.
Click to hide internal directories.