Tag|Docs

Primary Value

Bind the first positional value with option:"value"

The first item in a tag expression is the primary value. Bind it with option:"value" when the tag has one main positional value.

prop:"'database.host'"
schema.go
type PropTag struct {
	Key string `option:"value"`
}

Add a tag name

The schema also declares the struct tag name it handles.

schema.go
func (PropTag) Tag() string {
	return "prop"
}

After parsing, Key contains database.host.

value is reserved for the primary value. Use it only once in a schema so the main value has a single destination.

Next, add named options when the tag needs explicit values such as defaults, formats, or environment keys.

On this page