encoding

package module
v0.0.0-...-9ee255c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v any) ([]byte, error)

Marshal returns the form encoding of v.

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal parses the form data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidValueError.

Types

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v any) error

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(v any) error

type InvalidUnmarshalError

type InvalidUnmarshalError struct {
	Type reflect.Type
}

An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. (The argument to Unmarshal must be a non-nil pointer.)

func (*InvalidUnmarshalError) Error

func (e *InvalidUnmarshalError) Error() string

type Marshaler

type Marshaler interface {
	MarshalForm() ([]byte, error)
}

Marshaler is the interface implemented by types that can marshal themselves into a form description.

type Unmarshaler

type Unmarshaler interface {
	UnmarshalForm([]byte) error
}

Unmarshaler is the interface implemented by types that can unmarshal a form description of themselves. The input can be assumed to be a valid encoding of a form value. UnmarshalForm must copy the form data if it wishes to retain the data after returning.

Directories

Path Synopsis
examples
basic command
form_request command

Jump to

Keyboard shortcuts

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