transformer

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 32 Imported by: 0

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