id

package
v3.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(format string, a ...interface{}) string

Generate creates a UUID based on a hashed string derived from the input format and arguments. This function is used primarilty in generating the NGINX Id

Parameters:

  • format: A format string, similar to fmt.Sprintf.
  • a: Variadic arguments to be substituted into the format string.

Process:

  1. Creates a SHA-256 hash from the formatted string (using `fmt.Sprintf`).
  2. Converts the hash to a hexadecimal string.
  3. Generates an MD5-based UUID using the hashed string.

Returns:

A string representation of the generated UUID.

func GenerateMessageID

func GenerateMessageID() string

GenerateMessageID generates a unique message ID, falling back to sha256 and timestamp if UUID generation fails.

Types

type UUIDGenerator

type UUIDGenerator func() (uuid.UUID, error)

UUIDGenerator defines a function type for generating UUIDs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL