Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxLengthValidator ¶
MaxLengthValidator returns a validator for AddValidated that rejects tags that are longer than maxTagLength characters, counted as Unicode code points rather than bytes, and tags that are not valid UTF-8. The error lists all the offending tags at once. A maxTagLength of zero or less disables the length check, but invalid UTF-8 is still rejected.
Types ¶
type Tags ¶
type Tags struct {
// contains filtered or unexported fields
}
Tags is a helper struct for merging, deleting and deduplicating the tags while preserving the order
func New ¶
New creates a Tag struct from a slice of tags, e.g. ["tag1", "tag2"] or a list of tags, e.g. "tag1,tag2"
func (*Tags) AddValidated ¶
AddValidated works like Add, but first passes the normalized tags to the given validator: if it returns an error, no tag is added and the error is returned, e.g. to reject a request that contains a tag that is too long.