namer

package
v0.0.0-...-be6f5f5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeUnitNamer

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

TimeUnitNamer is an namer optimized for lower memory allocations it uses rw cache underline

func MustNewTimeUnitNamer

func MustNewTimeUnitNamer(prefix string, unit clock.Unit) *TimeUnitNamer

MustNewTimeUnitNamer creates a new namer with names cache and panics if input parameters are invalid

func NewTimeUnitNamer

func NewTimeUnitNamer(prefix string, unit clock.Unit) (*TimeUnitNamer, error)

NewTimeUnitNamer creates a new namer with names cache prefix is expected to have only letters in lower case, digits or underscore and shouldn't be empty if inputs are invalid error is returned

func (*TimeUnitNamer) NameFor

func (nr *TimeUnitNamer) NameFor(unit clock.UnitNum) string

NameFor resolves name for specified unit it checks and updates cache if corresponding name were not found

func (*TimeUnitNamer) ParseUnit

func (nr *TimeUnitNamer) ParseUnit(name string) (clock.UnitNum, error)

ParseUnit attempts tp resolve unit from provided filter name

Jump to

Keyboard shortcuts

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