You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
355 B

package main
import (
"fmt"
"github.com/oklog/ulid"
"github.com/rs/xid"
"math/rand"
"strings"
"time"
)
func main() {
ak := xid.New()
fmt.Printf("ak:%s\n", ak.String())
t := time.Now().UTC()
entropy := rand.New(rand.NewSource(t.UnixNano()))
sk := ulid.MustNew(ulid.Timestamp(t), entropy)
fmt.Printf("sk:%s\n",strings.ToLower(sk.String()))
}