Documentation
¶
Overview ¶
anno is a versioning scheme based on day of year and elapsed seconds in UTC.
Structure:
Separater is a simple dot "." by default. Size: 2x1 [Can be adjusted by anno.Separator (global) or per object UseSeparater(string).] Years (00-99) Size: 2 [Your software will most probably outlast the century.] Day of year (000-365/366) Size: 3 [zero padded] Seconds elapsed on that day (00000-86400) Size: 5 [zero padded]
Apply extensions at discretion. Can contain modifier, major, minor, micro tags or whatever you wish for. You can make anno a unique value eg. (session-id) by adding a random value through extensions. (see examples below)
YY.DOY.SECONDS → 25.171.61040 YY = Current year minus 2000. This is not going to outlast to the next century. DOY = Number of day for the current year. SEC = Elapsed seconds of the current day. Unique enough for most use-cases. Can be unique by adding a random value through extensions.
Features:
- Contains useful information like a date unlike semver's arbitrary values.
- Not day specific like calver, but second of day specific.
- Unique enough for most version use-cases.
- It is a text sortable alternative to semver¹ or calver².
- Layout is flexible and extensible. (separator/extension/connector)
- Collects basic additional information for git repositories on request if available. (UNIX-only? Not tested on windows yet.)
Examples:
25.171.61454+main·4e38b9c·foo·bar Contains git values (branch/commit) and foo, bar extensions. anno -a foo -a bar -a $(printf "%04x:%04x" $RANDOM $RANDOM) 25.171.62238+main·4e38b9c·foo·bar·1cf4:663b Command line example with extensions foo, bar and random hex.
Index ¶
- Variables
- func Micro() string
- type Anno
- func (a *Anno) Anno() string
- func (a *Anno) Extensions() []string
- func (a *Anno) Git() (string, string)
- func (a *Anno) Integer() uint64
- func (a *Anno) String() string
- func (a *Anno) Time() time.Time
- func (a *Anno) UseConnector(connector string) *Anno
- func (a *Anno) UseExtension(extension string) *Anno
- func (a *Anno) UseSeparator(separator string) *Anno
- type Annos
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Separator string = "." Extension string = "·" Connector string = "+" )
Functions ¶
Types ¶
type Anno ¶
type Anno struct {
// contains filtered or unexported fields
}
Anno contains all values.
func (*Anno) Extensions ¶
Extensions returns all values of the given Anno.
func (*Anno) UseConnector ¶
func (*Anno) UseExtension ¶
func (*Anno) UseSeparator ¶
Click to show internal directories.
Click to hide internal directories.