Documentation ¶
Index ¶
- Constants
- func DefaultTimeUnmarshalLayouts() []string
- func JsonEncode(w io.Writer, v Value) error
- func JsonMarshal(v Value) ([]byte, error)
- func PredicatedMarshaler(fn MarshalPredicate, m Marshaler) bt.Pair[MarshalPredicate, Marshaler]
- func PredicatedUnmarshaler(fn UnmarshalPredicate, u Unmarshaler) bt.Pair[UnmarshalPredicate, Unmarshaler]
- func TrueMarshalPredicate(ctx *MarshalContext, rv reflect.Value) bool
- func TrueUnmarshalPredicate(ctx *UnmarshalContext, mv Value) bool
- func Unmarshal(mv Value, v any, o ...UnmarshalOpt) error
- type Any
- type AnyIterableMarshaler
- type AnyKvIterableMarshaler
- type Array
- type ArrayUnmarshaler
- type Base64Marshaler
- type Base64Unmarshaler
- type BaseContext
- type BaseMarshalOpt
- type BaseUnmarshalOpt
- type Bool
- type Bytes
- type CompositeFactory
- type CompositeStrategy
- type Container
- type ConvertMarshaler
- type ConvertUnmarshaler
- type EnumMarshaler
- type EnumUnmarshaler
- type Factory
- type Float
- type FuncFactory
- type FuncMarshaler
- type FuncUnmarshaler
- type IndexMarshaler
- type InheritImpls
- type Int
- type Manager
- func (m *Manager) Marshal(v any, o ...MarshalOpt) (Value, error)
- func (m *Manager) MarshalRfl(rv reflect.Value, o ...MarshalOpt) (Value, error)
- func (m *Manager) Unmarshal(mv Value, v any, o ...UnmarshalOpt) error
- func (m *Manager) UnmarshalRfl(mv Value, ty reflect.Type, o ...UnmarshalOpt) (reflect.Value, error)
- type MapMarshaler
- type MapUnmarshaler
- type MarshalContext
- type MarshalOpt
- type MarshalPredicate
- type Marshaler
- type MarshalerFactory
- func NewBase64MarshalerFactory() MarshalerFactory
- func NewCompositeMarshalerFactory(st CompositeStrategy, fs ...MarshalerFactory) MarshalerFactory
- func NewConvertUserPrimitiveMarshalerFactory() MarshalerFactory
- func NewFuncMarshalerFactory(fn func(ctx *MarshalContext, a reflect.Type) (Marshaler, error)) MarshalerFactory
- func NewIndexMarshalerFactory() MarshalerFactory
- func NewMapMarshalerFactory() MarshalerFactory
- func NewOptionalMarshalerFactory() MarshalerFactory
- func NewPointerMarshalerFactory() MarshalerFactory
- func NewPolymorphismMarshalerFactory(p *Polymorphism) MarshalerFactory
- func NewPrimitiveMarshalerFactory() MarshalerFactory
- func NewRecursiveMarshalerFactory(f MarshalerFactory) MarshalerFactory
- func NewRegistryPolymorphismMarshalerFactory() MarshalerFactory
- func NewStdTextMarshalerFactory() MarshalerFactory
- func NewTimeMarshalerFactory(layout string) MarshalerFactory
- func NewTypeCacheMarshalerFactory(f MarshalerFactory) MarshalerFactory
- func NewTypeMapMarshalerFactory(m map[reflect.Type]Marshaler) MarshalerFactory
- func NewTypeMarshalerFactory(impl Marshaler, tys ...reflect.Type) MarshalerFactory
- type Naming
- type Null
- type Number
- type Numeric
- type Object
- type ObjectFactory
- type ObjectFieldGetter
- type ObjectFieldSetter
- type ObjectMarshaler
- type ObjectMarshalerField
- type ObjectUnmarshaler
- type ObjectUnmarshalerField
- type OptionalMarshaler
- type OptionalUnmarshaler
- type PointerMarshaler
- type PointerUnmarshaler
- type Polymorphism
- type PolymorphismMarshaler
- type PolymorphismUnmarshaler
- type Primitive
- type PrimitiveMarshaler
- type PrimitiveUnmarshaler
- type RecursiveTypeFactory
- type ReflectIterableMarshaler
- type ReflectKvIterableMarshaler
- type Registry
- type RegistryItem
- type RegistryMarshalerFactory
- type RegistryUnmarshalerFactory
- type SetField
- type SetImpl
- type SetType
- type Simple
- type SliceUnmarshaler
- type StdTextMarshaler
- type StdTextUnmarshaler
- type String
- type StructMarshalerFactory
- type StructUnmarshalerFactory
- type SwitchMarshaler
- type SwitchUnmarshaler
- type TimeMarshaler
- type TimeUnmarshaler
- type TypeCacheFactory
- type TypeMapFactory
- type UnhandledTypeError
- type UnmarshalContext
- type UnmarshalOpt
- type UnmarshalPredicate
- type Unmarshaler
- type UnmarshalerFactory
- func NewBase64UnmarshalerFactory() UnmarshalerFactory
- func NewCompositeUnmarshalerFactory(st CompositeStrategy, fs ...UnmarshalerFactory) UnmarshalerFactory
- func NewConvertPrimitiveUnmarshalerFactory() UnmarshalerFactory
- func NewConvertUserPrimitiveUnmarshalerFactory() UnmarshalerFactory
- func NewFuncUnmarshalerFactory(fn func(ctx *UnmarshalContext, a reflect.Type) (Unmarshaler, error)) UnmarshalerFactory
- func NewIndexUnmarshalerFactory() UnmarshalerFactory
- func NewMapUnmarshalerFactory() UnmarshalerFactory
- func NewOptionalUnmarshalerFactory() UnmarshalerFactory
- func NewPointerUnmarshalerFactory() UnmarshalerFactory
- func NewPolymorphismUnmarshalerFactory(p *Polymorphism) UnmarshalerFactory
- func NewPrimitiveUnmarshalerFactory() UnmarshalerFactory
- func NewRecursiveUnmarshalerFactory(f UnmarshalerFactory) UnmarshalerFactory
- func NewRegistryPolymorphismUnmarshalerFactory() UnmarshalerFactory
- func NewStdTextUnmarshalerFactory(ty reflect.Type) UnmarshalerFactory
- func NewTimeUnmarshalerFactory(layouts []string) UnmarshalerFactory
- func NewTypeCacheUnmarshalerFactory(f UnmarshalerFactory) UnmarshalerFactory
- func NewTypeMapUnmarshalerFactory(m map[reflect.Type]Unmarshaler) UnmarshalerFactory
- func NewTypeUnmarshalerFactory(impl Unmarshaler, tys ...reflect.Type) UnmarshalerFactory
- type Value
Constants ¶
View Source
const DefaultTimeMarshalLayout = time.RFC3339Nano
Variables ¶
This section is empty.
Functions ¶
func DefaultTimeUnmarshalLayouts ¶
func DefaultTimeUnmarshalLayouts() []string
func JsonMarshal ¶
func PredicatedMarshaler ¶
func PredicatedMarshaler(fn MarshalPredicate, m Marshaler) bt.Pair[MarshalPredicate, Marshaler]
func PredicatedUnmarshaler ¶
func PredicatedUnmarshaler(fn UnmarshalPredicate, u Unmarshaler) bt.Pair[UnmarshalPredicate, Unmarshaler]
func TrueMarshalPredicate ¶
func TrueMarshalPredicate(ctx *MarshalContext, rv reflect.Value) bool
func TrueUnmarshalPredicate ¶
func TrueUnmarshalPredicate(ctx *UnmarshalContext, mv Value) bool
Types ¶
type Any ¶
type Any struct {
// contains filtered or unexported fields
}
func (Any) MarshalJSON ¶
func (Any) WriteString ¶
func (v Any) WriteString(w iou.DiscardStringWriter)
type AnyIterableMarshaler ¶
type AnyIterableMarshaler struct {
// contains filtered or unexported fields
}
func NewAnyIterableMarshaler ¶
func NewAnyIterableMarshaler(m Marshaler) AnyIterableMarshaler
func (AnyIterableMarshaler) Marshal ¶
func (m AnyIterableMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type AnyKvIterableMarshaler ¶
type AnyKvIterableMarshaler struct {
// contains filtered or unexported fields
}
func NewAnyKvIterableMarshaler ¶
func NewAnyKvIterableMarshaler(k, v Marshaler) AnyKvIterableMarshaler
func (AnyKvIterableMarshaler) Marshal ¶
func (m AnyKvIterableMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
func (Array) MarshalJSON ¶
func (Array) WriteString ¶
func (v Array) WriteString(w iou.DiscardStringWriter)
type ArrayUnmarshaler ¶
type ArrayUnmarshaler struct {
// contains filtered or unexported fields
}
func NewArrayUnmarshaler ¶
func NewArrayUnmarshaler(ty reflect.Type, elem Unmarshaler) ArrayUnmarshaler
func (ArrayUnmarshaler) Unmarshal ¶
func (u ArrayUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type Base64Marshaler ¶
type Base64Marshaler struct{}
func (Base64Marshaler) Marshal ¶
func (m Base64Marshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type Base64Unmarshaler ¶
type Base64Unmarshaler struct{}
func (Base64Unmarshaler) Unmarshal ¶
func (u Base64Unmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type BaseContext ¶
type BaseContext interface {
// contains filtered or unexported methods
}
type BaseMarshalOpt ¶
type BaseMarshalOpt struct{}
type BaseUnmarshalOpt ¶
type BaseUnmarshalOpt struct{}
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func (Bool) MarshalJSON ¶
func (Bool) WriteString ¶
func (v Bool) WriteString(w iou.DiscardStringWriter)
type Bytes ¶
type Bytes struct {
// contains filtered or unexported fields
}
func (Bytes) MarshalJSON ¶
func (Bytes) WriteString ¶
func (v Bytes) WriteString(w iou.DiscardStringWriter)
type CompositeFactory ¶
type CompositeFactory[R, C, A any] struct { // contains filtered or unexported fields }
func NewCompositeFactory ¶
func NewCompositeFactory[R, C, A any](st CompositeStrategy, fs ...Factory[R, C, A]) CompositeFactory[R, C, A]
func (CompositeFactory[R, C, A]) Make ¶
func (f CompositeFactory[R, C, A]) Make(ctx C, a A) (R, error)
type CompositeStrategy ¶
type CompositeStrategy int8
const ( FirstComposite CompositeStrategy = iota OneComposite )
type ConvertMarshaler ¶
type ConvertMarshaler struct {
// contains filtered or unexported fields
}
func NewConvertMarshaler ¶
func NewConvertMarshaler(ty reflect.Type, child Marshaler) ConvertMarshaler
func (ConvertMarshaler) Marshal ¶
func (m ConvertMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type ConvertUnmarshaler ¶
type ConvertUnmarshaler struct {
// contains filtered or unexported fields
}
func NewConvertUnmarshaler ¶
func NewConvertUnmarshaler(ty reflect.Type, child Unmarshaler) ConvertUnmarshaler
func (ConvertUnmarshaler) Unmarshal ¶
func (u ConvertUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type EnumMarshaler ¶
type EnumMarshaler[T comparable] struct { // contains filtered or unexported fields }
func NewEnumMarshaler ¶
func NewEnumMarshaler[T comparable](m map[T]string) EnumMarshaler[T]
func (EnumMarshaler[T]) Marshal ¶
func (m EnumMarshaler[T]) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type EnumUnmarshaler ¶
type EnumUnmarshaler struct {
// contains filtered or unexported fields
}
func NewEnumUnmarshaler ¶
func NewEnumUnmarshaler(m map[string]any) EnumUnmarshaler
func (EnumUnmarshaler) Unmarshal ¶
func (u EnumUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
func (Float) MarshalJSON ¶
func (Float) WriteString ¶
func (v Float) WriteString(w iou.DiscardStringWriter)
type FuncFactory ¶
type FuncFactory[R, C, A any] struct { // contains filtered or unexported fields }
func NewFuncFactory ¶
func NewFuncFactory[R, C, A any](fn func(ctx C, a A) (R, error)) FuncFactory[R, C, A]
func (FuncFactory[R, C, A]) Make ¶
func (f FuncFactory[R, C, A]) Make(ctx C, a A) (R, error)
type FuncMarshaler ¶
type FuncMarshaler struct {
// contains filtered or unexported fields
}
func NewFuncMarshaler ¶
func NewFuncMarshaler(fn func(ctx *MarshalContext, rv reflect.Value) (Value, error)) FuncMarshaler
func (FuncMarshaler) Marshal ¶
func (m FuncMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type FuncUnmarshaler ¶
type FuncUnmarshaler struct {
// contains filtered or unexported fields
}
func NewFuncUnmarshaler ¶
func NewFuncUnmarshaler(fn func(ctx *UnmarshalContext, mv Value) (reflect.Value, error)) FuncUnmarshaler
func (FuncUnmarshaler) Unmarshal ¶
func (u FuncUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type IndexMarshaler ¶
type IndexMarshaler struct {
// contains filtered or unexported fields
}
func NewIndexMarshaler ¶
func NewIndexMarshaler(elem Marshaler) IndexMarshaler
func (IndexMarshaler) Marshal ¶
func (m IndexMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type InheritImpls ¶
func InheritImplsOf ¶
func InheritImplsOf[T any]() InheritImpls
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
func (Int) MarshalJSON ¶
func (Int) WriteString ¶
func (v Int) WriteString(w iou.DiscardStringWriter)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func GlobalManager ¶
func GlobalManager() *Manager
func NewDefaultManager ¶
func (*Manager) MarshalRfl ¶
func (*Manager) UnmarshalRfl ¶
type MapMarshaler ¶
type MapMarshaler struct {
// contains filtered or unexported fields
}
func NewMapMarshaler ¶
func NewMapMarshaler(k, v Marshaler) MapMarshaler
func (MapMarshaler) Marshal ¶
func (m MapMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type MapUnmarshaler ¶
type MapUnmarshaler struct {
// contains filtered or unexported fields
}
func NewMapUnmarshaler ¶
func NewMapUnmarshaler(ty reflect.Type, k, v Unmarshaler) MapUnmarshaler
func (MapUnmarshaler) Unmarshal ¶
func (u MapUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type MarshalContext ¶
type MarshalOpt ¶
type MarshalOpt interface {
// contains filtered or unexported methods
}
type MarshalPredicate ¶
type MarshalPredicate = func(ctx *MarshalContext, rv reflect.Value) bool
type Marshaler ¶
type Marshaler interface {
Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
}
type MarshalerFactory ¶
type MarshalerFactory = Factory[Marshaler, *MarshalContext, reflect.Type]
func NewBase64MarshalerFactory ¶
func NewBase64MarshalerFactory() MarshalerFactory
func NewCompositeMarshalerFactory ¶
func NewCompositeMarshalerFactory(st CompositeStrategy, fs ...MarshalerFactory) MarshalerFactory
func NewConvertUserPrimitiveMarshalerFactory ¶
func NewConvertUserPrimitiveMarshalerFactory() MarshalerFactory
func NewFuncMarshalerFactory ¶
func NewFuncMarshalerFactory(fn func(ctx *MarshalContext, a reflect.Type) (Marshaler, error)) MarshalerFactory
func NewIndexMarshalerFactory ¶
func NewIndexMarshalerFactory() MarshalerFactory
func NewMapMarshalerFactory ¶
func NewMapMarshalerFactory() MarshalerFactory
func NewOptionalMarshalerFactory ¶
func NewOptionalMarshalerFactory() MarshalerFactory
func NewPointerMarshalerFactory ¶
func NewPointerMarshalerFactory() MarshalerFactory
func NewPolymorphismMarshalerFactory ¶
func NewPolymorphismMarshalerFactory(p *Polymorphism) MarshalerFactory
func NewPrimitiveMarshalerFactory ¶
func NewPrimitiveMarshalerFactory() MarshalerFactory
func NewRecursiveMarshalerFactory ¶
func NewRecursiveMarshalerFactory(f MarshalerFactory) MarshalerFactory
func NewRegistryPolymorphismMarshalerFactory ¶
func NewRegistryPolymorphismMarshalerFactory() MarshalerFactory
func NewStdTextMarshalerFactory ¶
func NewStdTextMarshalerFactory() MarshalerFactory
func NewTimeMarshalerFactory ¶
func NewTimeMarshalerFactory(layout string) MarshalerFactory
func NewTypeCacheMarshalerFactory ¶
func NewTypeCacheMarshalerFactory(f MarshalerFactory) MarshalerFactory
func NewTypeMapMarshalerFactory ¶
func NewTypeMapMarshalerFactory(m map[reflect.Type]Marshaler) MarshalerFactory
func NewTypeMarshalerFactory ¶
func NewTypeMarshalerFactory(impl Marshaler, tys ...reflect.Type) MarshalerFactory
type Naming ¶
func CamelNaming ¶
func CamelNaming() Naming
func SnakeNaming ¶
func SnakeNaming() Naming
type Null ¶
type Null struct {
// contains filtered or unexported fields
}
func (Null) MarshalJSON ¶
func (Null) WriteString ¶
func (v Null) WriteString(w iou.DiscardStringWriter)
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
func MakeNumber ¶
func (Number) MarshalJSON ¶
func (Number) WriteString ¶
func (v Number) WriteString(w iou.DiscardStringWriter)
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func (Object) MarshalJSON ¶
func (Object) WriteString ¶
func (v Object) WriteString(w iou.DiscardStringWriter)
type ObjectFactory ¶
type ObjectFactory = func(ctx *UnmarshalContext) reflect.Value
func NewStructFactory ¶
func NewStructFactory(si *stu.StructInfo) ObjectFactory
type ObjectFieldGetter ¶
type ObjectFieldGetter = func(ctx *MarshalContext, rv reflect.Value) (bt.Optional[reflect.Value], error)
func NewStructFieldGetter ¶
func NewStructFieldGetter(fi *stu.FieldInfo) ObjectFieldGetter
type ObjectFieldSetter ¶
type ObjectFieldSetter = func(ctx *UnmarshalContext, ov, fv reflect.Value) error
func NewStructFieldSetter ¶
func NewStructFieldSetter(fi *stu.FieldInfo) ObjectFieldSetter
type ObjectMarshaler ¶
type ObjectMarshaler struct {
// contains filtered or unexported fields
}
func NewObjectMarshaler ¶
func NewObjectMarshaler(flds ...ObjectMarshalerField) ObjectMarshaler
func (ObjectMarshaler) Marshal ¶
func (m ObjectMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type ObjectMarshalerField ¶
type ObjectMarshalerField struct { Name string Get ObjectFieldGetter Impl Marshaler }
func NewObjectMarshalerField ¶
func NewObjectMarshalerField( name string, get ObjectFieldGetter, impl Marshaler, ) ObjectMarshalerField
type ObjectUnmarshaler ¶
type ObjectUnmarshaler struct {
// contains filtered or unexported fields
}
func NewObjectUnmarshaler ¶
func NewObjectUnmarshaler(fac ObjectFactory, flds ...ObjectUnmarshalerField) ObjectUnmarshaler
func (ObjectUnmarshaler) Unmarshal ¶
func (u ObjectUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type ObjectUnmarshalerField ¶
type ObjectUnmarshalerField struct { Name string Set ObjectFieldSetter Impl Unmarshaler }
func NewObjectUnmarshalerField ¶
func NewObjectUnmarshalerField( name string, set ObjectFieldSetter, impl Unmarshaler, ) ObjectUnmarshalerField
type OptionalMarshaler ¶
type OptionalMarshaler struct {
// contains filtered or unexported fields
}
func NewOptionalMarshaler ¶
func NewOptionalMarshaler(ty reflect.Type, elem Marshaler) OptionalMarshaler
func (OptionalMarshaler) Marshal ¶
func (m OptionalMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type OptionalUnmarshaler ¶
type OptionalUnmarshaler struct {
// contains filtered or unexported fields
}
func NewOptionalUnmarshaler ¶
func NewOptionalUnmarshaler(ty reflect.Type, elem Unmarshaler) OptionalUnmarshaler
func (OptionalUnmarshaler) Unmarshal ¶
func (u OptionalUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type PointerMarshaler ¶
type PointerMarshaler struct {
// contains filtered or unexported fields
}
func NewPointerMarshaler ¶
func NewPointerMarshaler(elem Marshaler) PointerMarshaler
func (PointerMarshaler) Marshal ¶
func (m PointerMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type PointerUnmarshaler ¶
type PointerUnmarshaler struct {
// contains filtered or unexported fields
}
func NewPointerUnmarshaler ¶
func NewPointerUnmarshaler(ty reflect.Type, elem Unmarshaler) PointerUnmarshaler
func (PointerUnmarshaler) Unmarshal ¶
func (u PointerUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type Polymorphism ¶
type Polymorphism struct {
// contains filtered or unexported fields
}
func NewPolymorphism ¶
func NewPolymorphism(ty reflect.Type, es []SetImpl, naming Naming) *Polymorphism
type PolymorphismMarshaler ¶
type PolymorphismMarshaler struct {
// contains filtered or unexported fields
}
func NewPolymorphismMarshaler ¶
func NewPolymorphismMarshaler(p *Polymorphism, m map[reflect.Type]Marshaler) PolymorphismMarshaler
func (PolymorphismMarshaler) Marshal ¶
func (m PolymorphismMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type PolymorphismUnmarshaler ¶
type PolymorphismUnmarshaler struct {
// contains filtered or unexported fields
}
func NewPolymorphismUnmarshaler ¶
func NewPolymorphismUnmarshaler(m map[string]Unmarshaler) PolymorphismUnmarshaler
func (PolymorphismUnmarshaler) Unmarshal ¶
func (u PolymorphismUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type PrimitiveMarshaler ¶
type PrimitiveMarshaler struct{}
func (PrimitiveMarshaler) Marshal ¶
func (p PrimitiveMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type PrimitiveUnmarshaler ¶
type PrimitiveUnmarshaler struct{}
func (PrimitiveUnmarshaler) Unmarshal ¶
func (p PrimitiveUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type RecursiveTypeFactory ¶
type RecursiveTypeFactory[R, C any] struct { // contains filtered or unexported fields }
func NewRecursiveTypeFactory ¶
func NewRecursiveTypeFactory[R, C any](f Factory[R, C, reflect.Type], p func() (R, func(R))) RecursiveTypeFactory[R, C]
type ReflectIterableMarshaler ¶
type ReflectIterableMarshaler struct {
// contains filtered or unexported fields
}
func NewReflectIterableMarshaler ¶
func NewReflectIterableMarshaler(m Marshaler) ReflectIterableMarshaler
func (ReflectIterableMarshaler) Marshal ¶
func (m ReflectIterableMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type ReflectKvIterableMarshaler ¶
type ReflectKvIterableMarshaler struct {
// contains filtered or unexported fields
}
func NewReflectKvIterableMarshaler ¶
func NewReflectKvIterableMarshaler(k, v Marshaler) ReflectKvIterableMarshaler
func (ReflectKvIterableMarshaler) Marshal ¶
func (m ReflectKvIterableMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func GlobalRegistry ¶
func GlobalRegistry() *Registry
func NewRegistry ¶
func RegisterTo ¶
func RegisterTo[T any](items ...RegistryItem) *Registry
type RegistryItem ¶
type RegistryItem interface {
// contains filtered or unexported methods
}
type RegistryMarshalerFactory ¶
type RegistryMarshalerFactory struct{}
func NewRegistryMarshalerFactory ¶
func NewRegistryMarshalerFactory() RegistryMarshalerFactory
func (RegistryMarshalerFactory) Make ¶
func (f RegistryMarshalerFactory) Make(ctx *MarshalContext, a reflect.Type) (Marshaler, error)
type RegistryUnmarshalerFactory ¶
type RegistryUnmarshalerFactory struct{}
func NewRegistryUnmarshalerFactory ¶
func NewRegistryUnmarshalerFactory() RegistryUnmarshalerFactory
func (RegistryUnmarshalerFactory) Make ¶
func (f RegistryUnmarshalerFactory) Make(ctx *UnmarshalContext, a reflect.Type) (Unmarshaler, error)
type SetField ¶
type SetField struct { Name string Tag string Omit bool Marshaler Marshaler Unmarshaler Unmarshaler }
type SetType ¶
type SetType struct { Marshaler Marshaler Unmarshaler Unmarshaler MarshalerFactory MarshalerFactory UnmarshalerFactory UnmarshalerFactory }
func SetEnumTypes ¶
func SetEnumTypes[T comparable](m map[T]string) SetType
func SetStringerEnumTypes ¶
func SetStringerEnumTypes[T comparable](vs ...T) SetType
type SliceUnmarshaler ¶
type SliceUnmarshaler struct {
// contains filtered or unexported fields
}
func NewSliceUnmarshaler ¶
func NewSliceUnmarshaler(ty reflect.Type, elem Unmarshaler) SliceUnmarshaler
func (SliceUnmarshaler) Unmarshal ¶
func (u SliceUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type StdTextMarshaler ¶
type StdTextMarshaler struct{}
func (StdTextMarshaler) Marshal ¶
func (m StdTextMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type StdTextUnmarshaler ¶
type StdTextUnmarshaler struct {
// contains filtered or unexported fields
}
func (StdTextUnmarshaler) Unmarshal ¶
func (u StdTextUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type String ¶
type String struct {
// contains filtered or unexported fields
}
func MakeString ¶
func (String) MarshalJSON ¶
func (String) WriteString ¶
func (v String) WriteString(w iou.DiscardStringWriter)
type StructMarshalerFactory ¶
type StructMarshalerFactory struct {
// contains filtered or unexported fields
}
func NewStructMarshalerFactory ¶
func NewStructMarshalerFactory(sic *stu.StructInfoCache) StructMarshalerFactory
func (StructMarshalerFactory) Make ¶
func (mf StructMarshalerFactory) Make(ctx *MarshalContext, ty reflect.Type) (Marshaler, error)
type StructUnmarshalerFactory ¶
type StructUnmarshalerFactory struct {
// contains filtered or unexported fields
}
func NewStructUnmarshalerFactory ¶
func NewStructUnmarshalerFactory(sic *stu.StructInfoCache) StructUnmarshalerFactory
func (StructUnmarshalerFactory) Make ¶
func (mf StructUnmarshalerFactory) Make(ctx *UnmarshalContext, ty reflect.Type) (Unmarshaler, error)
type SwitchMarshaler ¶
type SwitchMarshaler struct {
// contains filtered or unexported fields
}
func NewSwitchMarshaler ¶
func NewSwitchMarshaler(s ...bt.Pair[MarshalPredicate, Marshaler]) SwitchMarshaler
func (SwitchMarshaler) Marshal ¶
func (m SwitchMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type SwitchUnmarshaler ¶
type SwitchUnmarshaler struct {
// contains filtered or unexported fields
}
func NewSwitchUnmarshaler ¶
func NewSwitchUnmarshaler(s ...bt.Pair[UnmarshalPredicate, Unmarshaler]) SwitchUnmarshaler
func (SwitchUnmarshaler) Unmarshal ¶
func (m SwitchUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type TimeMarshaler ¶
type TimeMarshaler struct {
// contains filtered or unexported fields
}
func NewTimeMarshaler ¶
func NewTimeMarshaler(layout string) TimeMarshaler
func (TimeMarshaler) Marshal ¶
func (m TimeMarshaler) Marshal(ctx *MarshalContext, rv reflect.Value) (Value, error)
type TimeUnmarshaler ¶
type TimeUnmarshaler struct {
// contains filtered or unexported fields
}
func NewTimeUnmarshaler ¶
func NewTimeUnmarshaler(layouts []string) TimeUnmarshaler
func (TimeUnmarshaler) Unmarshal ¶
func (u TimeUnmarshaler) Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
type TypeCacheFactory ¶
type TypeCacheFactory[R any, C BaseContext] struct { // contains filtered or unexported fields }
func NewTypeCacheFactory ¶
func NewTypeCacheFactory[R any, C BaseContext](f Factory[R, C, reflect.Type]) *TypeCacheFactory[R, C]
type TypeMapFactory ¶
type TypeMapFactory[R, C any] struct { // contains filtered or unexported fields }
func NewTypeMapFactory ¶
func NewTypeMapFactory[R, C any](m map[reflect.Type]R) TypeMapFactory[R, C]
type UnhandledTypeError ¶
type UnhandledTypeError struct {
// contains filtered or unexported fields
}
func UnhandledType ¶
func UnhandledType() UnhandledTypeError
func UnhandledTypeOf ¶
func UnhandledTypeOf(ty reflect.Type) UnhandledTypeError
func (UnhandledTypeError) Error ¶
func (e UnhandledTypeError) Error() string
type UnmarshalContext ¶
type UnmarshalContext struct { BaseContext Make func(ctx *UnmarshalContext, ty reflect.Type) (Unmarshaler, error) Opts ctr.Map[reflect.Type, UnmarshalOpt] Reg *Registry }
type UnmarshalOpt ¶
type UnmarshalOpt interface {
// contains filtered or unexported methods
}
type UnmarshalPredicate ¶
type UnmarshalPredicate = func(ctx *UnmarshalContext, mv Value) bool
type Unmarshaler ¶
type Unmarshaler interface {
Unmarshal(ctx *UnmarshalContext, mv Value) (reflect.Value, error)
}
func NewStdTextUnmarshaler ¶
func NewStdTextUnmarshaler(ty reflect.Type) Unmarshaler
type UnmarshalerFactory ¶
type UnmarshalerFactory = Factory[Unmarshaler, *UnmarshalContext, reflect.Type]
func NewBase64UnmarshalerFactory ¶
func NewBase64UnmarshalerFactory() UnmarshalerFactory
func NewCompositeUnmarshalerFactory ¶
func NewCompositeUnmarshalerFactory(st CompositeStrategy, fs ...UnmarshalerFactory) UnmarshalerFactory
func NewConvertPrimitiveUnmarshalerFactory ¶
func NewConvertPrimitiveUnmarshalerFactory() UnmarshalerFactory
func NewConvertUserPrimitiveUnmarshalerFactory ¶
func NewConvertUserPrimitiveUnmarshalerFactory() UnmarshalerFactory
func NewFuncUnmarshalerFactory ¶
func NewFuncUnmarshalerFactory(fn func(ctx *UnmarshalContext, a reflect.Type) (Unmarshaler, error)) UnmarshalerFactory
func NewIndexUnmarshalerFactory ¶
func NewIndexUnmarshalerFactory() UnmarshalerFactory
func NewMapUnmarshalerFactory ¶
func NewMapUnmarshalerFactory() UnmarshalerFactory
func NewOptionalUnmarshalerFactory ¶
func NewOptionalUnmarshalerFactory() UnmarshalerFactory
func NewPointerUnmarshalerFactory ¶
func NewPointerUnmarshalerFactory() UnmarshalerFactory
func NewPolymorphismUnmarshalerFactory ¶
func NewPolymorphismUnmarshalerFactory(p *Polymorphism) UnmarshalerFactory
func NewPrimitiveUnmarshalerFactory ¶
func NewPrimitiveUnmarshalerFactory() UnmarshalerFactory
func NewRecursiveUnmarshalerFactory ¶
func NewRecursiveUnmarshalerFactory(f UnmarshalerFactory) UnmarshalerFactory
func NewRegistryPolymorphismUnmarshalerFactory ¶
func NewRegistryPolymorphismUnmarshalerFactory() UnmarshalerFactory
func NewStdTextUnmarshalerFactory ¶
func NewStdTextUnmarshalerFactory(ty reflect.Type) UnmarshalerFactory
func NewTimeUnmarshalerFactory ¶
func NewTimeUnmarshalerFactory(layouts []string) UnmarshalerFactory
func NewTypeCacheUnmarshalerFactory ¶
func NewTypeCacheUnmarshalerFactory(f UnmarshalerFactory) UnmarshalerFactory
func NewTypeMapUnmarshalerFactory ¶
func NewTypeMapUnmarshalerFactory(m map[reflect.Type]Unmarshaler) UnmarshalerFactory
func NewTypeUnmarshalerFactory ¶
func NewTypeUnmarshalerFactory(impl Unmarshaler, tys ...reflect.Type) UnmarshalerFactory
type Value ¶
type Value interface { Interface() any WriteString(w iou.DiscardStringWriter) String() string // contains filtered or unexported methods }
func JsonUnmarshal ¶
func MakeSimpleValue ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.