tags

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Example
t := New(nil)
t.Add("k=1")
t.Add("k=2")
fmt.Println(t.Unique())
fmt.Println(t.Values("k="))
Output:
[k=1 k=2]
[1 2]

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToLabels

func ToLabels(tags []string) map[string]string

ToLabels constructs a map of a list of labels.

func ToTags

func ToTags(labels map[string]string) []string

ToLabels constructs a list of labels.

Types

type Tags

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

Tags holds tags.

func New

func New(tags []string) *Tags

New creates a new Tag instance.

func (*Tags) Add

func (t *Tags) Add(tag string)

Add adds a tag

func (*Tags) Has

func (t *Tags) Has(tag string) bool

Has checks whether the given tag is contained in the tags.

func (*Tags) HasPrefix

func (t *Tags) HasPrefix(prefix string) bool

HasPrefix checks whether the given prefix is contained in the tags.

func (*Tags) Remove

func (t *Tags) Remove(tag string) bool

Remove removes a tag

func (*Tags) Unique

func (t *Tags) Unique() []string

Unique returns the distinct tag values as sorted slice.

func (*Tags) Values

func (t *Tags) Values(prefix string) []string

Values collects all the values that are contained with the given prefix.

Jump to

Keyboard shortcuts

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