marshaler

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMimeTypeUnsupported  = errorer.Errorf("unknown MIME type")
	ErrMimeTypeUnsupportedV = errorer.Errorfn(ErrMimeTypeUnsupported)
	ErrNotFile              = errorer.Errorf("not a file")
	ErrNotFileV             = errorer.Errorfn(ErrNotFile)
)

Functions

func Marshal added in v1.0.2

func Marshal[T any](ss *[]T, mt mime_type.MimeType, bs []byte) error

func MimeTypeFromFile added in v1.0.4

func MimeTypeFromFile(path string) (mime_type.MimeType, error)

func MimeTypeFromPath added in v1.0.4

func MimeTypeFromPath(root string) (map[string]mime_type.MimeType, error)

func ReadFromFile added in v1.0.4

func ReadFromFile(path string) ([]byte, mime_type.MimeType, error)

func ReadFromPath added in v1.0.4

func ReadFromPath(root string) (map[string]ReadContent, error)

func UnmarshalFromBytes added in v1.0.4

func UnmarshalFromBytes[T any](data []byte, v T, mt mime_type.MimeType) error

func UnmarshalFromFile added in v1.0.2

func UnmarshalFromFile[T any](path string) (T, mime_type.MimeType, error)

func UnmarshalFromPath added in v1.0.2

func UnmarshalFromPath[T any](root string, m map[string]UnmarshaledContent[T]) error

Types

type ReadContent added in v1.0.4

type ReadContent struct {
	Data     []byte
	MimeType mime_type.MimeType
}

type UnmarshaledContent added in v1.0.4

type UnmarshaledContent[V any] struct {
	Value    V
	MimeType mime_type.MimeType
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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