tags

package
v0.0.0-...-4aac04f Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TAG_MANAGER_FILENAME string = "tags.dat"
)

Variables

View Source
var (
	ErrManagerClosed   = errors.New("Manager is closed")
	ErrOpenHandles     = errors.New("tag manager has open handles is closed")
	ErrNoActiveHandles = errors.New("tag manager is not active")
)
View Source
var (
	ErrNotFound      = errors.New("not found")
	ErrNotActive     = errors.New("not active")
	ErrNoEmptyString = errors.New("Tag cannot be an empty string")
)

Functions

func CloseTagSets

func CloseTagSets() (err error)

func GetTagDatPath

func GetTagDatPath(basedir string) string

func ReleaseTagMan

func ReleaseTagMan(id uint64, guid uuid.UUID) (err error)

Types

type TagMan

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

func GetTagMan

func GetTagMan(id uint64, guid uuid.UUID, basedir string) (tm *TagMan, err error)

func New

func New(p string) (*TagMan, error)

func (*TagMan) Active

func (tm *TagMan) Active() bool

func (*TagMan) AddTag

func (tm *TagMan) AddTag(name string) error

func (*TagMan) Close

func (tm *TagMan) Close() (err error)

func (*TagMan) Count

func (tm *TagMan) Count() (cnt int, err error)

Count returns the number of active tags

func (*TagMan) EnsureTag

func (tm *TagMan) EnsureTag(id entry.EntryTag, name string) error

func (*TagMan) GetAndPopulate

func (tm *TagMan) GetAndPopulate(name string) (entry.EntryTag, error)

func (*TagMan) GetTag

func (tm *TagMan) GetTag(name string) (entry.EntryTag, error)

func (*TagMan) GetTagSubmap

func (tm *TagMan) GetTagSubmap(tags []entry.EntryTag) (mp map[string]entry.EntryTag, err error)

func (*TagMan) ImportTags

func (tm *TagMan) ImportTags(tgs []string) error

func (*TagMan) Merge

func (tm *TagMan) Merge(s []TagPair) (updated bool, err error)

Merge attempts to merge the given tag set pair list into the given tag manager if two tag names are the same, we check that the tag ids are the same if they are not the same, we throw an error

func (*TagMan) ResetOverride

func (tm *TagMan) ResetOverride(s []TagPair) (err error)

ResetOverride forces the tag manager to completely reset state and treat the provided tag set and use the provided tags. If the provided set does not contain "default" and "gravwell" they are automatically added

func (*TagMan) ReverseLookup

func (tm *TagMan) ReverseLookup(tg entry.EntryTag) (string, error)

func (*TagMan) TagSet

func (tm *TagMan) TagSet() (pairs []TagPair, err error)

type TagManager

type TagManager interface {
	AddTag(name string) error
	ImportTags(tags []string) error
	EnsureTag(id entry.EntryTag, name string) error
	GetAndPopulate(name string) (entry.EntryTag, error)
	GetTag(name string) (entry.EntryTag, error)
	ReverseLookup(tg entry.EntryTag) (string, error)
	TagSet() ([]TagPair, error)
	ResetOverride([]TagPair) error
	GetTagSubmap([]entry.EntryTag) (map[string]entry.EntryTag, error)
	Merge([]TagPair) (bool, error)
	Active() bool
	Count() (int, error)
}

type TagPair

type TagPair struct {
	Name  string
	Value entry.EntryTag
}

func StaticTagPairs

func StaticTagPairs() []TagPair

Jump to

Keyboard shortcuts

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