unmarshal

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

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