encodingx

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package encodingx provides bounded serialization with typed errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Operation string
	Cause     error
}

Error contains a typed serialization failure with its underlying cause.

func (*Error) Error

func (e *Error) Error() string

Error returns a diagnostic error description.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying wrapped resource or error cause.

type JSON

type JSON struct{ MaxBytes int }

JSON implements bounded standard JSON serialization.

func (JSON) Decode

func (j JSON) Decode(b []byte, v any) error

Decode decodes a size-bounded representation into the destination.

func (JSON) Encode

func (j JSON) Encode(v any) ([]byte, error)

Encode serializes a value and enforces its configured size limit.

type Raw

type Raw struct{ MaxBytes int }

Raw copies bounded byte representations.

func (Raw) Decode

func (r Raw) Decode(b []byte, v any) error

Decode decodes a size-bounded representation into the destination.

func (Raw) Encode

func (r Raw) Encode(v any) ([]byte, error)

Encode serializes a value and enforces its configured size limit.

type Serializer

type Serializer interface {
	Encode(any) ([]byte, error)
	Decode([]byte, any) error
}

Serializer encodes and decodes transport representations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL