Documentation
¶
Overview ¶
Package uidc provides functions to generate simple time-and-random-based unique identifiers.
It offers functions to generate 64-bit and 128-bit random identifiers in base-36 string format.
The generated IDs are not intended for cryptographic or security-related purposes. Instead, they serve as simple unique identifiers for various use cases.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewID128 ¶
func NewID128() string
NewID128 returns a 128-bit unique identifier encoded as a base-36 string. The high 64 bits are derived from the current time; the low 64 bits are random.
Example ¶
package main
import (
"fmt"
"github.com/tecnickcom/gogen/pkg/uidc"
)
func main() {
v := uidc.NewID128()
fmt.Println(v)
}
func NewID64 ¶
func NewID64() string
NewID64 returns a 64-bit unique ID encoded as a base-36 string. The upper 32 bits contain a timestamp and the lower 32 bits are random. The timestamp epoch is January 1st of the current decade's starting year.
Example ¶
package main
import (
"fmt"
"github.com/tecnickcom/gogen/pkg/uidc"
)
func main() {
v := uidc.NewID64()
fmt.Println(v)
}
Types ¶
This section is empty.