idfile

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDFile

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

IDFile represents a persistent string <==> uint32 mapping.

func New

func New(filepath string) (*IDFile, error)

New initializes the idfile, reading the existing values if applicable.

func (*IDFile) AddValue

func (m *IDFile) AddValue(value string) uint32

AddValue adds a new value to the IDFile (if it doesn't already exist), returning its assigned ID.

func (*IDFile) Commit

func (m *IDFile) Commit() error

Commit writes the IDFile to disk.

func (*IDFile) NextID

func (m *IDFile) NextID() uint32

NextID returns the next ID that will be assigned by the idfile.

func (*IDFile) ResolveID

func (m *IDFile) ResolveID(valID uint32) (string, error)

ResolveID returns the value of a given ID.

func (*IDFile) ResolveValue

func (m *IDFile) ResolveValue(value string) (uint32, bool)

ResolveValue returns the ID corresponding to the specified value.

Jump to

Keyboard shortcuts

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