Versions in this module Expand all Collapse all v10 v10.1.0 Aug 15, 2026 v10.0.0 Aug 12, 2026 Changes in this version + const ContentTypeHeaderKey + var ContentTypes = []ContentType + var ErrUnsupportedContentType = platformerrors.New("unsupported content type") + func Decode(data []byte, ct ContentType, dest any) error + func DecodeJSON(data []byte, dest any) error + func Encode(data any, ct ContentType) ([]byte, error) + func EncodeJSON(data any) ([]byte, error) + func MustDecode(data []byte, ct ContentType, dest any) + func MustDecodeJSON(data []byte, dest any) + func MustEncode(data any, ct ContentType) []byte + func MustEncodeJSON(data any) []byte + func MustJSONIntoReader(data any) io.Reader + func RegisterServerEncoderDecoder(i do.Injector) + type ClientEncoder interface + Encode func(ctx context.Context, dest io.Writer, v any) error + EncodeReader func(ctx context.Context, data any) (io.Reader, error) + type Codec interface + ContentType func() string + type Config struct + ContentType string + func (cfg *Config) ValidateWithContext(ctx context.Context) error + type ContentType string + const ContentTypeCBOR + const ContentTypeEmoji + const ContentTypeJSON + const ContentTypeTOML + const ContentTypeXML + const ContentTypeYAML + func NewContentType(cfg Config) (ContentType, error) + func ParseContentType(val string) (ContentType, error) + func (c ContentType) String() string + func (c ContentType) Valid() bool + type Encoder struct + func NewClientEncoder(encoding ContentType, opts ...Option) *Encoder + func (e *Encoder) ContentType() string + func (e *Encoder) Encode(ctx context.Context, dest io.Writer, data any) error + func (e *Encoder) EncodeReader(ctx context.Context, data any) (io.Reader, error) + func (e *Encoder) Marshal(ctx context.Context, v any) ([]byte, error) + func (e *Encoder) Unmarshal(ctx context.Context, data []byte, v any) error + type EncoderDecoder struct + func NewServerEncoderDecoder(contentType ContentType, opts ...Option) *EncoderDecoder + func (e *EncoderDecoder) DecodeBytes(ctx context.Context, data []byte, dest any) error + func (e *EncoderDecoder) DecodeRequest(ctx context.Context, req *http.Request, v any) error + func (e *EncoderDecoder) EncodeResponseWithStatus(ctx context.Context, res http.ResponseWriter, v any, statusCode int) + func (e *EncoderDecoder) MustEncode(ctx context.Context, v any) []byte + func (e *EncoderDecoder) MustEncodeJSON(ctx context.Context, v any) []byte + func (e *EncoderDecoder) RespondWithData(ctx context.Context, res http.ResponseWriter, v any) + type Marshaler interface + Marshal func(ctx context.Context, v any) ([]byte, error) + type Option func(*options) + func WithLogger(logger logging.Logger) Option + func WithPillars(p *observability.Pillars) Option + func WithTracerProvider(tracerProvider tracing.Provider) Option + type ServerEncoderDecoder interface + DecodeBytes func(ctx context.Context, payload []byte, dest any) error + DecodeRequest func(ctx context.Context, req *http.Request, dest any) error + EncodeResponseWithStatus func(ctx context.Context, res http.ResponseWriter, val any, statusCode int) + MustEncode func(ctx context.Context, v any) []byte + MustEncodeJSON func(ctx context.Context, v any) []byte + RespondWithData func(ctx context.Context, res http.ResponseWriter, val any) + type Unmarshaler interface + Unmarshal func(ctx context.Context, data []byte, v any) error Other modules containing this package github.com/primandproper/platform-go github.com/primandproper/platform-go/v11 github.com/primandproper/platform-go/v12 github.com/primandproper/platform-go/v2 github.com/primandproper/platform-go/v3 github.com/primandproper/platform-go/v4 github.com/primandproper/platform-go/v5 github.com/primandproper/platform-go/v6 github.com/primandproper/platform-go/v7 github.com/primandproper/platform-go/v8 github.com/primandproper/platform-go/v9