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 As[A ...](x Schema) (A, bool)
- func AsDefault[A ...](x Schema, def A) A
- func Compare(a, b Schema) int
- func FormatUnionNameUsingFullName(t reflect.Type) string
- func FormatUnionNameUsingTypeName(t reflect.Type) string
- func FormatUnionNameUsingTypeNameWithPackage(t reflect.Type) string
- func MatchSchema[TOut any](x Schema, f1 func(x *None) TOut, f2 func(x *Bool) TOut, ...) TOut
- func MatchSchemaR2[TOut1, TOut2 any](x Schema, f1 func(x *None) (TOut1, TOut2), f2 func(x *Bool) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MustMatchSchema[TOut any](x Schema, f1 func(x *None) TOut, f2 func(x *Bool) TOut, ...) TOut
- func MustMatchSchemaR0(x Schema, f1 func(x *None), f2 func(x *Bool), f3 func(x *Number), ...)
- func MustMatchSchemaR2[TOut1, TOut2 any](x Schema, f1 func(x *None) (TOut1, TOut2), f2 func(x *Bool) (TOut1, TOut2), ...) (TOut1, TOut2)
- func MustToGo(x Schema, options ...goConfigFunc) any
- func Reduce[A any](data Schema, init A, fn func(Schema, A) A) A
- 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 RegisterUnionTypes[A any](x *UnionVariants[A])
- func SetDefaultUnionTypeFormatter(f UnionFormatFunc)
- func ToDynamoDB(x Schema) types.AttributeValue
- func ToGo(x Schema, options ...goConfigFunc) (any, error)
- func ToGoG[A any](x Schema, options ...goConfigFunc) (A, error)
- func ToJSON(schema Schema) ([]byte, error)
- func WithDefaultListDef(def TypeListDefinition) goConfigFunc
- func WithDefaultMaoDef(def TypeMapDefinition) goConfigFunc
- func WithExtraRules(rules ...RuleMatcher) goConfigFunc
- func WithOnlyTheseRules(rules ...RuleMatcher) goConfigFunc
- func WithRulesFromRegistry(registry *Registry) goConfigFunc
- func WithUnionFormatter(f UnionFormatFunc) goConfigFunc
- func WithoutDefaultRegistry() goConfigFunc
- type Binary
- type Bool
- type Field
- type List
- type ListBuilder
- type Map
- type MapBuilder
- type Marshaler
- type NativeList
- type NativeMap
- type None
- type Number
- type Registry
- type RuleMatcher
- type Schema
- type SchemaBreadthFirstVisitor
- func (d *SchemaBreadthFirstVisitor[A]) VisitBinary(v *Binary) any
- 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]) ReduceBinary(x *Binary, agg A) (result A, stop bool)
- 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]) VisitBinary(v *Binary) any
- 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]) VisitBinary(v *Binary) any
- 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 SelfUnmarshallingStructBuilder
- type String
- type StructBuilder
- type StructDefinition
- type TypeListDefinition
- type TypeMapDefinition
- type UnionFormatFunc
- type UnionMap
- type UnionVariants
- type Unmarshaler
- type WhenField
- type WrapInMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatUnionNameUsingFullName ¶ added in v1.9.0
func FormatUnionNameUsingTypeName ¶ added in v1.9.0
func FormatUnionNameUsingTypeNameWithPackage ¶ added in v1.9.0
func MatchSchema ¶ added in v1.10.0
func MatchSchemaR2 ¶ added in v1.10.0
func MatchSchemaR2[TOut1, TOut2 any]( x Schema, f1 func(x *None) (TOut1, TOut2), f2 func(x *Bool) (TOut1, TOut2), f3 func(x *Number) (TOut1, TOut2), f4 func(x *String) (TOut1, TOut2), f5 func(x *Binary) (TOut1, TOut2), f6 func(x *List) (TOut1, TOut2), f7 func(x *Map) (TOut1, TOut2), df func(x Schema) (TOut1, TOut2), ) (TOut1, TOut2)
func MustMatchSchema ¶ added in v1.7.3
func MustMatchSchemaR0 ¶ added in v1.14.1
func MustMatchSchemaR2 ¶ added in v1.7.3
func MustMatchSchemaR2[TOut1, TOut2 any]( x Schema, f1 func(x *None) (TOut1, TOut2), f2 func(x *Bool) (TOut1, TOut2), f3 func(x *Number) (TOut1, TOut2), f4 func(x *String) (TOut1, TOut2), f5 func(x *Binary) (TOut1, TOut2), f6 func(x *List) (TOut1, TOut2), f7 func(x *Map) (TOut1, TOut2), ) (TOut1, TOut2)
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 RegisterUnionTypes ¶ added in v1.9.0
func RegisterUnionTypes[A any](x *UnionVariants[A])
func SetDefaultUnionTypeFormatter ¶ added in v1.9.0
func SetDefaultUnionTypeFormatter(f UnionFormatFunc)
func ToDynamoDB ¶ added in v1.7.7
func ToDynamoDB(x Schema) types.AttributeValue
func WithDefaultListDef ¶ added in v1.9.0
func WithDefaultListDef(def TypeListDefinition) goConfigFunc
func WithDefaultMaoDef ¶ added in v1.9.0
func WithDefaultMaoDef(def TypeMapDefinition) goConfigFunc
func WithExtraRules ¶ added in v1.9.0
func WithExtraRules(rules ...RuleMatcher) goConfigFunc
func WithOnlyTheseRules ¶ added in v1.9.0
func WithOnlyTheseRules(rules ...RuleMatcher) goConfigFunc
func WithRulesFromRegistry ¶ added in v1.9.0
func WithRulesFromRegistry(registry *Registry) goConfigFunc
func WithUnionFormatter ¶ added in v1.9.0
func WithUnionFormatter(f UnionFormatFunc) goConfigFunc
func WithoutDefaultRegistry ¶ added in v1.9.0
func WithoutDefaultRegistry() goConfigFunc
Types ¶
type Binary ¶ added in v1.11.0
type Binary struct{ B []byte }
func (*Binary) AcceptSchema ¶ added in v1.15.0
func (r *Binary) AcceptSchema(v SchemaVisitor) any
type Bool ¶
type Bool bool
func (*Bool) AcceptSchema ¶ added in v1.15.0
func (r *Bool) AcceptSchema(v SchemaVisitor) any
type List ¶
type List struct {
Items []Schema
}
func (*List) AcceptSchema ¶ added in v1.15.0
func (r *List) AcceptSchema(v SchemaVisitor) any
type ListBuilder ¶ added in v1.9.0
type Map ¶
type Map struct {
Field []Field
}
func (*Map) AcceptSchema ¶ added in v1.15.0
func (r *Map) AcceptSchema(v SchemaVisitor) any
type MapBuilder ¶ added in v1.9.0
type NativeList ¶
type NativeList struct {
// contains filtered or unexported fields
}
func (*NativeList) Append ¶ added in v1.9.0
func (s *NativeList) Append(value any) error
func (*NativeList) Build ¶ added in v1.9.0
func (s *NativeList) Build() any
func (*NativeList) NewListBuilder ¶ added in v1.9.0
func (s *NativeList) NewListBuilder() ListBuilder
type NativeMap ¶
type NativeMap struct {
// contains filtered or unexported fields
}
func (*NativeMap) NewMapBuilder ¶ added in v1.9.0
func (s *NativeMap) NewMapBuilder() MapBuilder
type None ¶
type None struct{}
func (*None) AcceptSchema ¶ added in v1.15.0
func (r *None) AcceptSchema(v SchemaVisitor) any
type Number ¶
type Number float64
func (*Number) AcceptSchema ¶ added in v1.15.0
func (r *Number) AcceptSchema(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) SetUnionTypeFormatter ¶ added in v1.9.0
func (r *Registry) SetUnionTypeFormatter(f UnionFormatFunc)
type RuleMatcher ¶
type Schema ¶ added in v1.7.3
type Schema interface {
AcceptSchema(g SchemaVisitor) any
}
func FromDynamoDB ¶ added in v1.7.7
func FromDynamoDB(x types.AttributeValue) (Schema, error)
func UnwrapDynamoDB ¶ added in v1.12.0
type SchemaBreadthFirstVisitor ¶ added in v1.7.3
type SchemaBreadthFirstVisitor[A any] struct { // contains filtered or unexported fields }
func (*SchemaBreadthFirstVisitor[A]) VisitBinary ¶ added in v1.11.0
func (d *SchemaBreadthFirstVisitor[A]) VisitBinary(v *Binary) any
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) OnBinary func(x *Binary, 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]) ReduceBinary ¶ added in v1.11.0
func (t *SchemaDefaultReduction[A]) ReduceBinary(x *Binary, 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 OnBinary func(x *Binary) A OnList func(x *List) A OnMap func(x *Map) A }
func (*SchemaDefaultVisitor[A]) VisitBinary ¶ added in v1.11.0
func (t *SchemaDefaultVisitor[A]) VisitBinary(v *Binary) any
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]) VisitBinary ¶ added in v1.11.0
func (d *SchemaDepthFirstVisitor[A]) VisitBinary(v *Binary) any
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) ReduceBinary(x *Binary, 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 SelfUnmarshallingStructBuilder ¶ added in v1.13.0
type SelfUnmarshallingStructBuilder struct {
// contains filtered or unexported fields
}
func UseSelfUnmarshallingStruct ¶ added in v1.13.0
func UseSelfUnmarshallingStruct(new func() Unmarshaler) *SelfUnmarshallingStructBuilder
func (*SelfUnmarshallingStructBuilder) NewMapBuilder ¶ added in v1.13.0
func (c *SelfUnmarshallingStructBuilder) NewMapBuilder() MapBuilder
type String ¶
type String string
func (*String) AcceptSchema ¶ added in v1.15.0
func (r *String) AcceptSchema(v SchemaVisitor) any
type StructBuilder ¶ added in v1.9.0
type StructBuilder struct {
// contains filtered or unexported fields
}
func (*StructBuilder) Build ¶ added in v1.9.0
func (s *StructBuilder) Build() any
type StructDefinition ¶ added in v1.9.0
type StructDefinition struct {
// contains filtered or unexported fields
}
func (*StructDefinition) NewMapBuilder ¶ added in v1.9.0
func (s *StructDefinition) NewMapBuilder() MapBuilder
type TypeListDefinition ¶ added in v1.9.0
type TypeListDefinition interface {
NewListBuilder() ListBuilder
}
type TypeMapDefinition ¶ added in v1.9.0
type TypeMapDefinition interface {
NewMapBuilder() MapBuilder
}
func UseReflectionUnmarshallingStruct ¶ added in v1.13.0
func UseReflectionUnmarshallingStruct(t any) TypeMapDefinition
func UseStruct ¶
func UseStruct(t any) TypeMapDefinition
func UseTypeDef ¶ added in v1.9.0
func UseTypeDef(definition TypeMapDefinition) TypeMapDefinition
type UnionFormatFunc ¶ added in v1.9.0
type UnionMap ¶ added in v1.9.0
type UnionMap struct {
// contains filtered or unexported fields
}
func (*UnionMap) NewMapBuilder ¶ added in v1.9.0
func (u *UnionMap) NewMapBuilder() MapBuilder
type UnionVariants ¶ added in v1.9.0
type UnionVariants[A any] struct { // contains filtered or unexported fields }
func MustDefineUnion ¶ added in v1.9.0
func MustDefineUnion[A any](xs ...A) *UnionVariants[A]
func (*UnionVariants[A]) MapDefFor ¶ added in v1.9.0
func (u *UnionVariants[A]) MapDefFor(x *Map, path []string, config *goConfig) (TypeMapDefinition, bool)
func (*UnionVariants[A]) SchemaToUnionType ¶ added in v1.9.0
func (u *UnionVariants[A]) SchemaToUnionType(x any, schema Schema, config *goConfig) (Schema, bool)
type Unmarshaler ¶ added in v1.13.0
type WhenField ¶
type WhenField[A any] struct { // contains filtered or unexported fields }
func WhenPath ¶
func WhenPath(path []string, setter TypeMapDefinition) *WhenField[struct{}]
Source Files ¶
- builder.go
- dynamo_db.go
- go.go
- json.go
- model.go
- model_builder_custom.go
- model_builder_native.go
- model_builder_struct.go
- model_mkunion_schema_default_reducer.go
- model_mkunion_schema_default_visitor.go
- model_mkunion_schema_reducer_bfs.go
- model_mkunion_schema_reducer_dfs.go
- model_mkunion_schema_visitor.go
- model_rule_union.go
- model_rule_when_field.go
- model_rule_wrap_in_field.go
- registry.go
- utils.go
Click to show internal directories.
Click to hide internal directories.