摘要:
GOLANG 深拷贝: package main import ( "fmt" "reflect" ) func DeepCopy(src interface{}) interface{} { if src == nil { return nil } srcVal := reflect.ValueO 阅读全文
posted @ 2025-10-06 17:58
calochCN
阅读(6)
评论(0)
推荐(0)
摘要:
go, get net/http connection count var activeConnections int32 func handler(w http.ResponseWriter, r *http.Request) { atomic.AddInt32(&activeConnection 阅读全文
posted @ 2025-10-06 17:34
calochCN
阅读(7)
评论(0)
推荐(0)
摘要:
手动数据库分片 // 手动分片逻辑示例 func getShardDB(userID int) *gorm.DB { dbIndex := userID % 4 dsn := fmt.Sprintf("user:pwd@tcp(db-%d:3306)/user_db_%d", dbIndex, db 阅读全文
posted @ 2025-10-06 17:22
calochCN
阅读(5)
评论(0)
推荐(0)