structtag

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotAPointer error when not a pointer
	ErrNotAPointer = errors.New("Not a pointer")

	// ErrNotAStruct error when not a struct
	ErrNotAStruct = errors.New("Not a struct")

	// ErrTypeNotSupported error when type not supported
	ErrTypeNotSupported = errors.New("Type not supported")

	// ErrUndefinedTag error when Tag var is not defined
	ErrUndefinedTag = errors.New("Undefined tag")

	// Tag set the main tag
	Tag string

	// TagDefault set tag default
	TagDefault string

	// TagHelper set tag usage
	TagHelper string

	// TagDisabled used to not process an input
	TagDisabled string

	// TagSeparator separe names on environment variables
	TagSeparator string

	// Prefix is a string that would be placed at the beginning of the generated tags.
	Prefix string

	// ParseMap points to each of the supported types
	ParseMap map[reflect.Kind]ReflectFunc
)

Functions

func Parse

func Parse(s interface{}, superTag string) (err error)

Parse tags on struct instance

func ReflectStruct

func ReflectStruct(field *reflect.StructField, value *reflect.Value, tag string) (err error)

ReflectStruct is called when the Parse encounters a sub-structure in the current structure and then calls Parsr again to treat the fields of the sub-structure.

func Reset

func Reset()

Reset maps caling setup function

func Setup

func Setup()

Setup maps and variables

Types

type ReflectFunc

type ReflectFunc func(
	field *reflect.StructField,
	value *reflect.Value,
	tag string) (err error)

ReflectFunc type used to create funcrions to parse struct and tags

Jump to

Keyboard shortcuts

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