unmarshal

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 16 Imported by: ? 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateKeyPolicy

type DuplicateKeyPolicy int
const (
	LastWins DuplicateKeyPolicy = iota
	ErrorOnDuplicate
)

type Engine

type Engine struct {
	Ctx                context.Context
	Hooks              ScannerHooks
	UnknownFieldPolicy UnknownFieldPolicy
	NumberPolicy       NumberPolicy
	NullPolicy         NullPolicy
	DuplicateKeyPolicy DuplicateKeyPolicy
	MalformedPolicy    MalformedPolicy

	PathHook func(ctx context.Context, holder unsafe.Pointer, path []string, field string, value interface{}) (interface{}, error)
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, hooks ScannerHooks, unknown UnknownFieldPolicy, number NumberPolicy, nulls NullPolicy, duplicates DuplicateKeyPolicy, malformed MalformedPolicy, timeLayout string, caseKey string, compileName func(string) string, pathHook func(ctx context.Context, holder unsafe.Pointer, path []string, field string, value interface{}) (interface{}, error)) *Engine

func (*Engine) Unmarshal

func (e *Engine) Unmarshal(data []byte, dest interface{}) error

type MalformedPolicy

type MalformedPolicy int
const (
	Tolerant MalformedPolicy = iota
	FailFast
)

type NullPolicy

type NullPolicy int
const (
	CompatNulls NullPolicy = iota
	StrictNulls
)

type NumberPolicy

type NumberPolicy int
const (
	CoerceNumbers NumberPolicy = iota
	ExactNumbers
)

type PathError

type PathError struct {
	Path string
	Err  error
}

func (*PathError) Error

func (e *PathError) Error() string

type ScannerHooks

type ScannerHooks interface {
	SkipWhitespace(data []byte, pos int) int
	FindQuoteOrEscape(data []byte, pos int) (quotePos int, escapePos int)
	FindStructural(data []byte, pos int) int
}

type UnknownFieldPolicy

type UnknownFieldPolicy int
const (
	IgnoreUnknown UnknownFieldPolicy = iota
	ErrorOnUnknown
)

Jump to

Keyboard shortcuts

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