Categorygithub.com/anexia-it/go-structmapper
modulepackage
1.0.7
Repository: https://github.com/anexia-it/go-structmapper.git
Documentation: pkg.go.dev

# README

go-structmapper

license GoDoc Test Status Lint Status codecov Go Report Card

go-structmapper is a Go library which allows mapping arbitrary structs to maps and vice-versa.

Installing

To use go-structmapper just add github.com/anexia-it/go-structmapper <version> to your go.mod file.

# Functions

ForceStringMapKeys takes a map[string]interface{} and ensures that all maps which are nested in this top-level map are of type map[string]interface{}.
IsInvalidTag checks if the given error is an InvalidTag error and returns the InvalidTag error along with a boolean that defines if it is indeed an invalid tag error.
IsNilOrEmpty checks if a passed interface is either nil or of the type's zero value.
NewMapper initializes a new mapper instance.
OptionTagName sets the tag name the mapper uses.

# Constants

DefaultTagName defines the default tag name used by Mapper.

# Variables

ErrFieldIsInterface designates that a field is an interface.
ErrInvalidMap designates that the passed value is not a valid map.
ErrMapIsNil designates that the passed map is nil.
ErrNotAStruct designates that the passed value is not a struct.
ErrNotAStructPointer designates that the passed value is not a pointer to a struct.
ErrTagNameEmpty designates that the passed tag name is empty.

# Structs

InvalidTag is an error that indicates that the tag value was invalid.
Mapper provides the mapping logic.

# Type aliases

Option defines the type used by Mapper Option functions.