Documentation
¶
Index ¶
- type Engine
- func (e *Engine) ExcludeFields(t reflect.Type, paths []string) error
- func (e *Engine) Marshal(value interface{}) ([]byte, error)
- func (e *Engine) MarshalPtr(value interface{}) ([]byte, error)
- func (e *Engine) MarshalPtrTo(dst []byte, value interface{}) ([]byte, error)
- func (e *Engine) MarshalTo(dst []byte, value interface{}) ([]byte, error)
- func (e *Engine) MarshalTypedPtr(dst []byte, elemType reflect.Type, ptr unsafe.Pointer) ([]byte, error)
- func (e *Engine) Wire(t reflect.Type) (*WireShape, error)
- type Standard
- type StandardEncoder
- type WireProperty
- type WireShape
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
NameTransform func(path []string, field string) string
Exclude func(path []string, field string) bool
// contains filtered or unexported fields
}
Engine marshals values with transform/exclusion hooks.
func (*Engine) ExcludeFields ¶ added in v0.10.0
ExcludeFields compiles canonical Go-field paths through existing serializer plans, so aliases/casing/inline holders use the same output names as Marshal. Configure the engine before publishing or invoking it.
func (*Engine) MarshalPtr ¶
MarshalPtr marshals pointer roots on the fast pointer path.
func (*Engine) MarshalPtrTo ¶
MarshalPtrTo appends pointer-root marshaled JSON to dst.
type Standard ¶ added in v0.10.0
type Standard struct {
// contains filtered or unexported fields
}
Standard describes encoding/json v1 output. It never encodes values and does not reuse the transformed engine's field, omission or inline policy.
func NewStandard ¶ added in v0.10.0
type StandardEncoder ¶ added in v0.10.0
type StandardEncoder struct {
// contains filtered or unexported fields
}
StandardEncoder projects typed objects without a JSON roundtrip. Scalar, opaque custom and map values are delegated to encoding/json. Object field authority is x/shape.JSONFields, including JSON-specific promotion dominance.
func NewStandardEncoder ¶ added in v0.10.0
type WireProperty ¶ added in v0.10.0
type WireProperty struct {
// contains filtered or unexported fields
}
func (WireProperty) Field ¶ added in v0.10.0
func (p WireProperty) Field() reflect.StructField
Field returns provenance indexed from the containing WireShape.Source, including anonymous/inline ancestors. Returned indexes are detached.
func (WireProperty) Name ¶ added in v0.10.0
func (p WireProperty) Name() string
func (WireProperty) Required ¶ added in v0.10.0
func (p WireProperty) Required() bool
func (WireProperty) Shape ¶ added in v0.10.0
func (p WireProperty) Shape() *WireShape
type WireShape ¶ added in v0.10.0
type WireShape struct {
// contains filtered or unexported fields
}
WireShape is immutable JSON metadata from this engine's actual field plans. It is neither a Go type builder nor a schema dialect.
func (*WireShape) Properties ¶ added in v0.10.0
func (s *WireShape) Properties() []WireProperty