transformer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ForUnmarshalling = "unmarshal"
	ForMarshalling   = "marshal"
)

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(ctx context.Context, method, path_ string, payload any) (*http.Request, error)

func Register

func Register(p Provider)

func UnmarshalRequest

func UnmarshalRequest(req request.Request, x any) error

func UnmarshalUnderlyingRequest

func UnmarshalUnderlyingRequest(req *http.Request, x any) error

Types

type Arshaler

type Arshaler interface {
	Type() reflect.Type
	Values(*scanner.Field) iter.Seq[reflect.Value]
	ValuesForModification(*scanner.Field, int) iter.Seq2[int, reflect.Value]

	MarshalValues(ctx context.Context, f *scanner.Field) (values []string, err error)
	UnmarshalValues(ctx context.Context, f *scanner.Field, values []string) error
	UnmarshalReaders(ctx context.Context, f *scanner.Field, readers []io.ReadCloser) error

	MarshalRequest(ctx context.Context, method string, segments path.Segments) (*http.Request, error)
	UnmarshalRequest(r request.Request) error
	UnmarshalUnderlyingRequest(*http.Request) error
}

func NewArshaler

func NewArshaler(v reflect.Value) Arshaler

type Option

type Option struct {
	// contains filtered or unexported fields
}

func (*Option) Implements

func (i *Option) Implements(dst reflect.Type) bool

func (*Option) MediaType

func (i *Option) MediaType() string

func (*Option) PointerImpl

func (i *Option) PointerImpl(dst reflect.Type) bool

func (*Option) TypeImpl

func (i *Option) TypeImpl(dst reflect.Type) bool

type Provider

type Provider interface {
	Names() []string
	Transformer() (Transformer, error)
}

type Transformer

type Transformer interface {
	// Media presents transformer media type. eg: json, text, octet etc.
	Media() string

	content.Reader
	content.Provider
}

func New

func New(rtyp reflect.Type, typ, action string) (Transformer, error)

Jump to

Keyboard shortcuts

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