Documentation ¶
Index ¶
Constants ¶
const PATHSEP = ":"
const TAGCHARS = PATHSEP + "a-zA-Z0-9._-"
const TAGSEPS = ", "
Variables ¶
This section is empty.
Functions ¶
func GenerateFlatMap ¶
GenerateFlatMap takes a list of tags and transforms it into a map of string to array of string, where the map is keyed by the first element of each of the tags (before the first colon). The 'only' parameter limits the output to only the set of tags specified in only. If only is blank or contains a single empty string, then all tags are included.
func ParseTag ¶
ParseTag takes a single string and validates it as a single tag; returns error if it fails.
func UnmarshalTags ¶
UnmarshalTags accepts a Tags array and moves the data into a struct that is passed in as a pointer to the output object. Unmarshaling is controlled by the tags struct tag, very similar to the json.Unmarshal command. It supports unmarshaling data into bool, int, string, and []string fields.
Types ¶
type Tags ¶
type Tags []string
Tags is a type that's just an []string but it helps us to define a couple of helper functions on it
func MarshalTags ¶
func MarshalTagsX ¶ added in v1.2.0
MarshalTags returns the struct as Tags[]
MarshalTags traverses v looking for fields with a structure tag called tags, and interprets it to store values in the TagMap
func (Tags) Get ¶ added in v1.2.0
Get retrieves the portion of a tag after the colon after matching the part before the colon. If there are multiple values, it returns the first one
func (Tags) RemoveDups ¶
RemoveDups removes duplicate entries in the list of tags