Answers for "hpw to assign uuid in golang mongo"

2

using uuid golang

package main

import (
    "fmt"
    "strings"
    "github.com/google/uuid"
)

func main() {
    uuidWithHyphen := uuid.New()
    fmt.Println(uuidWithHyphen)
    uuid := strings.Replace(uuidWithHyphen.String(), "-", "", -1)
    fmt.Println(uuid)
}
Posted by: Guest on June-22-2021

Browse Popular Code Answers by Language