yao/agent/robot/utils/id.go
Max 90b52eaf22 Update TODO.md to Reflect Completion of Phases 1 and 2
- Marked Phase 1: Types & Interfaces as complete with 88.4% test coverage and all tests passing.
- Updated Phase 2: Skeleton Implementation status to complete, confirming all packages compile successfully without circular dependencies.
- Checked off all tasks under both phases, indicating full implementation of types, interfaces, and skeleton structures.
2026-01-14 18:03:08 +08:00

20 lines
413 B
Go

package utils
import (
gonanoid "github.com/matoous/go-nanoid/v2"
)
// NewID generates a new unique ID using nanoid
func NewID() string {
id, err := gonanoid.New()
if err != nil {
// Fallback to nanoid with default alphabet if error occurs
return gonanoid.Must()
}
return id
}
// NewIDWithPrefix generates a new ID with a prefix
func NewIDWithPrefix(prefix string) string {
return prefix + NewID()
}