decode

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: BSD-2-Clause Imports: 4 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorDstNotFound  = errors.New("destination not found")
	ErrorDstNotSet    = errors.New("destination not set")
	ErrorTypeMismatch = errors.New("type mismatch")
)

Functions

func Decode

func Decode(source interface{}, destination interface{}, tag string, flag DecoderFlag) error

Decode копирует данные из источника в назначение, поддерживая различные типы данных (структуры, мапы) и их вложенность, используя теги для сопоставления полей.

Types

type DecoderFlag

type DecoderFlag int
const (
	DecoderStrongFoundDst    DecoderFlag = 0x1 << iota // Error if not found destination
	DecoderStrongType                                  // Safe source type or error. Explode inner struct to map in map to map
	DecoderUnwrapStructToMap                           // Unwrap struct to map
)

Jump to

Keyboard shortcuts

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