tag

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidTag indicates an invalid tag or invalid use of an existing tag.
	ErrInvalidTag = errors.New("invalid tag")

	// ErrTag indicates an error while parsing flag tags.
	ErrTag = errors.New("tag error")
)

Functions

This section is empty.

Types

type MultiTag

type MultiTag struct {
	// contains filtered or unexported fields
}

MultiTag is a structure to efficiently query a struct field' tags, regardless of their complexity.

func GetFieldTag

func GetFieldTag(field reflect.StructField) (MultiTag, bool, error)

GetFieldTag directly reads, creates and parses a struct field and returns either a working multiTag, or an error if parsing failed.

func NewMultiTag

func NewMultiTag(v string) MultiTag

NewMultiTag returns a new multi tag from a field tag string. The tags have not been parsed, you must call tag.Parse().

func (*MultiTag) Get

func (x *MultiTag) Get(key string) (string, bool)

Get returns the value of a key, and if this key is set.

func (*MultiTag) GetMany

func (x *MultiTag) GetMany(key string) []string

Get returns the values of a key, and if this key is set.

func (*MultiTag) Parse

func (x *MultiTag) Parse() error

Parse scans the struct tag string for all keys and their values.

func (*MultiTag) Set

func (x *MultiTag) Set(key string, value string)

Set changes the value of a key in the cache.

func (*MultiTag) SetMany

func (x *MultiTag) SetMany(key string, value []string)

SetMany stores some values in the cache, for the given key.

Jump to

Keyboard shortcuts

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