- 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.
20 lines
413 B
Go
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()
|
|
}
|