transform

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(src interface{}, dest interface{}) error

Convert converts between types using JSON marshaling.

func Flatten

func Flatten(src map[string]interface{}, prefix string) map[string]interface{}

Flatten flattens nested maps.

func FromMap

func FromMap(src map[string]interface{}, dest interface{}, tagName string) error

FromMap converts a map to a struct.

func Merge

func Merge(dest, src interface{}) error

Merge merges source into destination (src overwrites dest).

func ToMap

func ToMap(src interface{}, tagName string) (map[string]interface{}, error)

ToMap converts a struct to a map.

func Unflatten

func Unflatten(src map[string]interface{}) map[string]interface{}

Unflatten unflattens a flat map.

Types

type Mapper

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

Mapper provides data transformation between structs.

func New

func New(tagName string) *Mapper

New creates a new mapper.

func (*Mapper) Map

func (m *Mapper) Map(src, dest interface{}) error

Map transforms from one struct to another.

Jump to

Keyboard shortcuts

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