Names - craterdog/go-component-framework GitHub Wiki

Overview

A name string is a sequence of identifiers that define a hierarchical namespace. Each name string has the following string format:

$name: ('/' identifier)+
$identifier: LETTER (LETTER | DIGIT | '-')*

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 name strings.

package main

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

func main() {
	// Create some new name strings using the module level constructor shortcuts.
	var name = fra.NameFromString("/bali-nebula")
	fmt.Println(name)
	name = fra.Name(
		[]fra.Identifier{
			"bali-nebula",
			"types",
			"elements",
			"Angle",
		},
	)
	fmt.Println(name)
	fmt.Println()

	// Iterate through the identifiers for the name string.
	var iterator = name.GetIterator()
	for iterator.HasNext() {
		var identifier = iterator.GetNext()
		fmt.Println(identifier)
	}
}

Try it out in the Go Playground...