feat: bootstrap reusable GoOmni framework
This commit is contained in:
16
middleware/request_id.go
Normal file
16
middleware/request_id.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func newRequestID() string {
|
||||
value := make([]byte, 16)
|
||||
if _, err := rand.Read(value); err == nil {
|
||||
return hex.EncodeToString(value)
|
||||
}
|
||||
return fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
}
|
||||
Reference in New Issue
Block a user