tagparser

package
v0.0.0-...-d3fa72d Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(fieldTag string) (result map[string][]string, err error)

Parse takes a struct field tag in Go's standard format, that is key:"value" pairs separated by spaces, and turns it into a map from keys to values, removing all "" around values in the process. For example, a field tag such as

`protobuf:"1"`

would be turned into the map

{ "protobuf": [ "1" ] }

func Unique

func Unique(values map[string][]string) map[string]string

Unique maps each value in a list-valued map to its first element. This is useful in combination with Parse whenever you are sure that there is only a single value associated to each key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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