Strings - craterdog/go-component-framework GitHub Wiki
Overview
A string is a primitive component type that consists of a sequence of intrinsic data values that may be iterated over and extracted. Like all primitive component types, a string is immutable.
⚠️ Note, the Go intrinsic string
data type is really a string of characters,
which is a specific type of string with an overly general name. Our use of the
term "string" refers to a general classification of string types containing nine
different types of strings:
Binary
- A binary type is a string of base 64 encoded bytes representing arbitrary data.Name
- A name type is a string of identifiers used to define a name in a global namespace.Narrative
- A narrative type is a string of Go strings that form a multiline text string.Pattern
- A pattern type is a string of runes that captures a regular expression textual pattern or a composite component template pattern that can be used to match other components.Quote
- A quote type is a string of runes that form a singleline text string.Tag
- A tag type is a string of bytes encoded using base 32 that defines a unique identifier that can guarantee that there will be no collisions between it and other tags, and makes the tags impossible to guess.Version
- A version type is a string of ordinal numbers[1..)
that represents a hierarchical versioning scheme (e.g.v1.2.3
) in a way that makes it easy to access specific version levels.
To view the details of a particular string class type click on the links listed in the side bar in the upper right corner ↗️ of this page.
Class Model
The following UML diagram shows the ClassLike
interfaces (shown in blue)
that are defined for each string class. The ClassLike
interfaces define
the constructors that are used to create new instances of each class type.
The string
package itself defines global functions (shown in orange) for
accessing each class interface. The global functions are the only concrete
functions defined in the package—everything else is either an abstract type or
an interface. This is in accordance with the Crater Dog Coding Conventions
defined
here.