added in License
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
// Copyright 2024 Patial Tech. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uid
|
||||
|
||||
import "github.com/sqids/sqids-go"
|
||||
|
23
util/uid/uuid.go
Normal file
23
util/uid/uuid.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2024 Patial Tech. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gitserver.in/patialtech/rano/util/logger"
|
||||
)
|
||||
|
||||
func NewUUID() string {
|
||||
id, err := uuid.NewV7()
|
||||
if err != nil {
|
||||
logger.Incident(context.Background(), "New UUID", err.Error())
|
||||
return fmt.Sprintf("%d", time.Now().UTC().UnixNano())
|
||||
}
|
||||
return id.String()
|
||||
}
|
Reference in New Issue
Block a user