util

package
v0.5.13 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package util 提供 Hexagon 框架的内部工具函数

本包是内部实现,不对外暴露。主要功能:

  • ID 生成:使用 toolkit/util/idgen 生成各类唯一标识
  • 随机字符串:生成随机字符串和十六进制字符串

注意:本包遵循基础设施复用原则,所有 ID 生成都使用 toolkit 提供的实现

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentID

func AgentID() string

AgentID generates a unique Agent ID

func GenerateID

func GenerateID(prefix string) string

GenerateID generates a unique ID with the given prefix. Format: {prefix}-{nanoid} Example: agent-Uakgb_J5m9g

func GenerateIDLong

func GenerateIDLong(prefix string) string

GenerateIDLong generates a longer unique ID with the given prefix. Format: {prefix}-{nanoid_16} Example: agent-Uakgb_J5m9g-abcd

func RandomHex

func RandomHex(n int) string

RandomHex generates a random hex string. For compatibility, this uses NanoID with hex alphabet.

func RandomString

func RandomString(n int) string

RandomString generates a random string of the given length. Delegates to toolkit's NanoID implementation.

func SessionID

func SessionID() string

SessionID generates a unique Session ID

func SpanID

func SpanID() string

SpanID generates a unique Span ID

func TraceID

func TraceID() string

TraceID generates a unique Trace ID (longer for distributed tracing)

Types

This section is empty.

Jump to

Keyboard shortcuts

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