contract

package
v2.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Serializer

type Serializer interface {
	Serialize(value any) ([]byte, error)

	Deserialize(payload []byte, target any) error

	ContentType() string
}

Serializer transforms values to and from their byte representation for one media type. Implementations must be safe for concurrent use: the framework wires each serializer as a process-wide singleton and every request goroutine calls it simultaneously, so an implementation holding reusable state — a buffer, a cached encoder, a memoization map — must synchronize it. Serialize returns bytes the caller owns and Deserialize leaves the target owning its bytes; neither side may retain or alias the other's buffers.

Jump to

Keyboard shortcuts

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