feat: 优化web

This commit is contained in:
2026-04-23 18:58:13 +08:00
commit 544a2f3428
160 changed files with 27327 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package id
import (
"sync"
)
var (
generator IDGenerator
once sync.Once
)
type IDGenerator interface {
generate() string
}
func New() string {
once.Do(func() {
generator = NewUUIDGenerator()
})
return generator.generate()
}
+15
View File
@@ -0,0 +1,15 @@
package id
import "github.com/google/uuid"
type UUIDGenerator struct {
}
func NewUUIDGenerator() IDGenerator {
return &UUIDGenerator{}
}
func (g *UUIDGenerator) generate() string {
id, _ := uuid.NewV7()
return id.String()
}