marshal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

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

func MarshalFile

func MarshalFile(path string, v any) error

func MarshalTo

func MarshalTo(w io.Writer, v any) error

func Unmarshal

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

func UnmarshalFile

func UnmarshalFile(path string, v any) error

func UnmarshalFrom

func UnmarshalFrom(r io.Reader, v any) error

Types

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader, elemSample any) (*Decoder, error)

func (*Decoder) Close

func (d *Decoder) Close() error

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, elemSample any) (*Encoder, error)

func (*Encoder) Close

func (e *Encoder) Close() error

func (*Encoder) Encode

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

func (*Encoder) EncodeAll

func (e *Encoder) EncodeAll(slice any) error

func (*Encoder) SetRestKeys added in v0.3.0

func (e *Encoder) SetRestKeys(keys []string)

type Marshaler added in v0.3.0

type Marshaler interface {
	MarshalCSV() (string, error)
}

type Unmarshaler added in v0.3.0

type Unmarshaler interface {
	UnmarshalCSV(s string) error
}

Jump to

Keyboard shortcuts

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