Versions - craterdog/go-component-framework GitHub Wiki

Overview

A version string is a sequence of ordinal numbers [1..) that define a hierarchical version space. Each version string has the following string format:

$version: 'v' ORDINAL ('.' ORDINAL)*

The source of this format is Bali Document Notation™ (Bali) defined here.

UML Diagram

A Quick Example

To whet your appetite, here is some short example code that demonstrates the use of version strings.

package main

import (
	fmt "fmt"
	fra "github.com/craterdog/go-component-framework/v7"
)

func main() {
	// Create some new version strings using the module level constructor shortcuts.
	var v1 = fra.VersionFromString("v1")
	fmt.Println(v1)
	var v5 = fra.Version([]fra.Ordinal{5, 21, 3})
	fmt.Println(v5)

	// Call some class methods.
	var class = fra.VersionClass()
	fmt.Println("Next version:", class.GetNextVersion(v5, 2))
	fmt.Println("Is valid next version:", class.IsValidNextVersion(v5, v1))
}

Try it out in the Go Playground...