github.com/wynshop-open-source/gomplate@v3.5.0+incompatible/docs-src/content/functions/uuid.yml (about)

     1  ns: uuid
     2  title: uuid functions
     3  preamble: |
     4    Functions for generating, parsing, and manipulating UUIDs.
     5  
     6    A UUID is a 128 bit (16 byte) _Universal Unique IDentifier_ as defined
     7    in [RFC 4122][]. Only RFC 4112-variant UUIDs can be generated, but all variants
     8    (even invalid ones) can be parsed and manipulated. Also, gomplate only supports
     9    generating version 1 and 4 UUIDs (with 4 being the most commonly-used variety
    10    these days). Versions 2, 3, and 5 are able to be supported: [log an issue][] if
    11    this is required for your use-case.
    12  
    13    [RFC 4122]: https://en.wikipedia.org/wiki/Universally_unique_identifier
    14    [log an issue]: https://github.com/hairyhenderson/gomplate/issues/new
    15  funcs:
    16    - name: uuid.V1
    17      description: |
    18        Create a version 1 UUID (based on the current MAC address and the current date/time).
    19  
    20        Use [`uuid.V4`](#uuid-v4) instead in most cases.
    21      pipeline: false
    22      examples:
    23        - |
    24          $ gomplate -i '{{ uuid.V1 }}'
    25          4d757e54-446d-11e9-a8fa-72000877c7b0
    26    - name: uuid.V4
    27      description: |
    28        Create a version 4 UUID (randomly generated).
    29  
    30        This function consumes entropy.
    31      pipeline: false
    32      examples:
    33        - |
    34          $ gomplate -i '{{ uuid.V4 }}'
    35          40b3c2d2-e491-4b19-94cd-461e6fa35a60
    36    - name: uuid.Nil
    37      description: |
    38        Returns the _nil_ UUID, that is, `00000000-0000-0000-0000-000000000000`,
    39        mostly for testing scenarios.
    40      pipeline: false
    41      examples:
    42        - |
    43          $ gomplate -i '{{ uuid.Nil }}'
    44          00000000-0000-0000-0000-000000000000
    45    - name: uuid.IsValid
    46      description: |
    47        Checks that the given UUID is in the correct format. It does not validate
    48        whether the version or variant are correct.
    49      pipeline: true
    50      arguments:
    51        - name: uuid
    52          required: true
    53          description: The uuid to check
    54      examples:
    55        - |
    56          $ gomplate -i '{{ if uuid.IsValid "totally invalid" }}valid{{ else }}invalid{{ end }}'
    57          invalid
    58        - |
    59          $ gomplate -i '{{ uuid.IsValid "urn:uuid:12345678-90ab-cdef-fedc-ba9876543210" }}'
    60          true
    61    - name: uuid.Parse
    62      description: |
    63        Parse a UUID for further manipulation or inspection.
    64  
    65        This function returns a `UUID` struct, as defined in the [github.com/google/uuid](https://godoc.org/github.com/google/uuid#UUID) package. See the docs for examples of functions or fields you can call.
    66  
    67        Both the standard UUID forms of `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` and
    68        `urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` are decoded as well as the
    69        Microsoft encoding `{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}` and the raw hex
    70        encoding (`xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`).
    71      pipeline: true
    72      arguments:
    73        - name: uuid
    74          required: true
    75          description: The uuid to parse
    76      examples:
    77        - |
    78          $ gomplate -i '{{ $u := uuid.Parse uuid.V4 }}{{ $u.Version }}, {{ $u.Variant}}'
    79          VERSION_4, RFC4122
    80        - |
    81          $ gomplate -i '{{ (uuid.Parse "000001f5-4470-21e9-9b00-72000877c7b0").Domain }}'
    82          Person