Documentation ¶
Overview ¶
Package "module" defines a universal constructor for each class that is exported by this module. Each constructor delegates the actual construction process to one of the classes defined in a subpackage for this module.
For detailed documentation on this entire module refer to the wiki:
This package follows the Crater Dog Technologies™ (craterdog) Go Coding Conventions located here:
Most of the classes defined in this module utilize a notation class to handle the parsing and formatting of instances of each class using a specific notation. The default notation is Crater Dog Collection Notation™ (CDCN), but others like JSON and XML could be supported as well.
Index ¶
- Constants
- func Array[V any](arguments ...any) col.ArrayLike[V]
- func Association[K comparable, V any](arguments ...any) col.AssociationLike[K, V]
- func Catalog[K comparable, V any](arguments ...any) col.CatalogLike[K, V]
- func FormatValue(value any) (source string)
- func ImplementsAspect(value any, aspect any) bool
- func IsDefined(value any) bool
- func IsUndefined(value any) bool
- func List[V any](arguments ...any) col.ListLike[V]
- func Map[K comparable, V any](arguments ...any) col.MapLike[K, V]
- func ParseSource(source string) (value any)
- func Queue[V any](arguments ...any) col.QueueLike[V]
- func Set[V any](arguments ...any) col.SetLike[V]
- func Stack[V any](arguments ...any) col.StackLike[V]
- type NotationLike
- type Rank
Constants ¶
const ( LesserRank = age.LesserRank EqualRank = age.EqualRank GreaterRank = age.GreaterRank )
Variables ¶
This section is empty.
Functions ¶
func Array ¶
Array[V] returns a new instance of an array collection of values. Any of the following argument types may be passed to this function:
- NotationLike
- uint representing the size of the array
- []V
- Sequential[V]
- string containing CDCN source code
func Association ¶
func Association[K comparable, V any](arguments ...any) col.AssociationLike[K, V]
Association[K, V] returns a new instance of an association between a key and value pair. The key and value are passed as arguments into this function.
func Catalog ¶
func Catalog[K comparable, V any](arguments ...any) col.CatalogLike[K, V]
Catalog[K, V] returns a new instance of a catalog collection of key-value pairs. Any of the following argument types may be passed to this function:
- NotationLike
- map[K]V
- []AssociationLike[K, V]
- Sequential[AssociationLike[K, V]]
- string containing CDCN source code
func FormatValue ¶ added in v4.11.0
FormatValue returns the CDCN formatted source string for the specified collection value.
func ImplementsAspect ¶ added in v4.12.0
ImplementsAspect determines whether or not the specified value implements the specified aspect. Since the aspect is a Go interface it must be passed into this function as follows:
ImplementAspect(value, (*AnAspect)(nil))
This passes a nil valued argument with the aspect type as the second argument.
func IsDefined ¶ added in v4.13.0
IsDefined determines whether of not the specified value is defined. The Go language does not provide an easy way to test this so we provide this function to make it easier. The result of the function is determined logically as:
- The value is a pointer and not set to nil; or
- The value is not a pointer and has a valid value.
An integer with a value of zero, for example is defined.
func IsUndefined ¶ added in v4.11.0
IsUndefined determines whether of not the specified value is undefined. The Go language does not provide an easy way to test this so we provide this function to make it easier. The result of the function is determined logically as:
- The value is a pointer and set to nil; or
- The value is not a pointer and has an invalid value.
An empty string, for example, is undefined.
func List ¶
List[V] returns a new instance of a list collection of values. Any of the following argument types may be passed to this function:
- NotationLike
- []V
- Sequential[V]
- string containing CDCN source code
func Map ¶
func Map[K comparable, V any](arguments ...any) col.MapLike[K, V]
Map[K, V] returns a new instance of a map collection of key-value pairs. Any of the following argument types may be passed to this function:
- NotationLike
- map[K]V
- []AssociationLike[K, V]
- Sequential[AssociationLike[K, V]]
- string containing CDCN source code
func ParseSource ¶ added in v4.11.0
ParseSource parses a source string for a collection defined using CDCN. It returns the corresponding collection value.
func Queue ¶
Queue[V] returns a new instance of a queue collection of values. Any of the following argument types may be passed to this function:
- NotationLike
- uint representing the capacity of the queue
- []V
- Sequential[V]
- string containing CDCN source code
func Set ¶
Set[V] returns a new instance of a set collection of values. Any of the following argument types may be passed to this function:
- NotationLike
- []V
- Sequential[V]
- string containing CDCN source code
- CollatorLike for ordering the set values
Types ¶
type NotationLike ¶ added in v4.1.0
type NotationLike = col.NotationLike
func CDCN ¶
func CDCN(arguments ...any) NotationLike
CDCN returns a notation class supporting the Crater Dog Technologies™ collection notation. It allows collections to be formatted using CDCN and then parsed to reconstruct the collections.
func JSON ¶
func JSON(arguments ...any) NotationLike
JSON returns a notation class supporting the JavaScript Object Notation. It allows collections to be formatted using JSON and then parsed to reconstruct the collections.
NOTE: This notation is not yet supported.
func XML ¶
func XML(arguments ...any) NotationLike
XML returns a notation class supporting the eXtensible Markup Language. It allows collections to be formatted using XML and then parsed to reconstruct the collections.
NOTE: This notation is not yet supported.
Directories ¶
Path | Synopsis |
---|---|
Package "agent" defines a set of agents that operate on values of a generic type.
|
Package "agent" defines a set of agents that operate on values of a generic type. |
Package "cdcn" provides a set of classes that provide an implementation of the notation-like abstract class for parsing and formatting source files containing Crater Dog Collection Notation™ (CDCN).
|
Package "cdcn" provides a set of classes that provide an implementation of the notation-like abstract class for parsing and formatting source files containing Crater Dog Collection Notation™ (CDCN). |
Package "collection" defines a set of simple, pragmatic abstract types and interfaces for Go based collections of values.
|
Package "collection" defines a set of simple, pragmatic abstract types and interfaces for Go based collections of values. |