structs

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package structs provides functions for struct conversion.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapField

func MapField(pointer interface{}, priority []string, recursive bool) map[string]*Field

MapField retrieves struct field as map[name/tag]*Field from <pointer>, and returns it.

The parameter <recursive> specifies whether retrieving the struct field recursively.

Note that it only retrieves the exported attributes with first letter up-case from struct.

func TagMapField

func TagMapField(pointer interface{}, priority []string, recursive bool) map[string]*Field

TagMapField retrieves struct tags as map[tag]*Field from <pointer>, and returns it.

The parameter <recursive> specifies whether retrieving the struct field recursively.

Note that it only retrieves the exported attributes with first letter up-case from struct.

func TagMapName

func TagMapName(pointer interface{}, priority []string, recursive bool) map[string]string

TagMapName retrieves struct tags as map[tag]attribute from <pointer>, and returns it.

The parameter <recursive> specifies whether retrieving the struct field recursively.

Note that it only retrieves the exported attributes with first letter up-case from struct.

Types

type Field

type Field struct {
	*structs.Field
	// Retrieved tag name. There might be more than one tags in the field,
	// but only one can be retrieved according to calling function rules.
	Tag string
}

Field is alias of structs.Field.

func TagFields added in v1.10.1

func TagFields(pointer interface{}, priority []string, recursive bool) []*Field

TagFields retrieves struct tags as []*Field from <pointer>, and returns it.

The parameter <recursive> specifies whether retrieving the struct field recursively.

Note that it only retrieves the exported attributes with first letter up-case from struct.

Jump to

Keyboard shortcuts

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