feat 初次提交

This commit is contained in:
2026-01-03 14:26:09 +08:00
parent 18eb946934
commit 3ea3a3ac6d
48 changed files with 5420 additions and 1 deletions

24
utils/snowflake.go Normal file
View File

@@ -0,0 +1,24 @@
package utils
import (
"github.com/bwmarrin/snowflake"
"log"
)
var instance *snowflake.Node
func InitSnowflake(node int64) *snowflake.Node {
n, err := snowflake.NewNode(node)
if err != nil {
log.Fatalf("create snowflake's node failed: %v", err)
}
instance = n
return instance
}
func SnowflakeInstance() *snowflake.Node {
if instance == nil {
log.Fatal("snowflake's not init")
}
return instance
}