uuid functions
Functions for generating, parsing, and manipulating UUIDs.
A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC 4122. Only RFC 4112-variant UUIDs can be generated, but all variants (even invalid ones) can be parsed and manipulated. Also, gomplate only supports generating version 1 and 4 UUIDs (with 4 being the most commonly-used variety these days). Versions 2, 3, and 5 are able to be supported: log an issue if this is required for your use-case.
uuid.V1
Create a version 1 UUID (based on the current MAC address and the current date/time).
Use uuid.V4 instead in most cases.
Added in gomplate v3.4.0
Usage
Examples
uuid.V4
Create a version 4 UUID (randomly generated).
This function consumes entropy.
Added in gomplate v3.4.0
Usage
Examples
uuid.Nil
Returns the nil UUID, that is, 00000000-0000-0000-0000-000000000000,
mostly for testing scenarios.
Added in gomplate v3.4.0
Usage
Examples
uuid.IsValid
Checks that the given UUID is in the correct format. It does not validate whether the version or variant are correct.
Added in gomplate v3.4.0
Usage
Arguments
| name | description |
|---|---|
uuid |
(required) The uuid to check |
Examples
uuid.Parse
Parse a UUID for further manipulation or inspection.
This function returns a UUID struct, as defined in the github.com/google/uuid package. See the docs for examples of functions or fields you can call.
Both the standard UUID forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the
Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex
encoding (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx).
Added in gomplate v3.4.0
Usage
Arguments
| name | description |
|---|---|
uuid |
(required) The uuid to parse |