Skip to content

Commit

Permalink
feat: gen
Browse files Browse the repository at this point in the history
  • Loading branch information
zhixunjie committed Sep 5, 2024
1 parent bc1dfd5 commit 4273940
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from 5b0ca6 to 8a302e
1 change: 1 addition & 0 deletions internal/logic/data/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (repo *ContactRepo) TableName(ownerId uint64) (dbName string, tbName string
// 分表规则:
// - 数据库前缀:message_xxx,规则:owner_id 倒数第三位数字就是分库值
// - 数据表前缀:contact_xxx,规则:owner_id 的最后两位就是分表值
// 🔥其实后四位都可以用来取余得到分表数,所有分表数是不止2位的
dbName = fmt.Sprintf("messsage_%v", ownerId%1000/100)
tbName = fmt.Sprintf("contact_%v", ownerId%model.TotalTableContact)

Expand Down
1 change: 1 addition & 0 deletions internal/logic/data/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (repo *MessageRepo) TableName(id uint64) (dbName string, tbName string) {
// 分表规则:
// - 数据库前缀:message_xxx,规则:id 倒数第三位数字就是分库值
// - 数据表前缀:message_xxx,规则:id 的最后两位就是分表值
// 🔥其实后四位都可以用来取余得到分表数,所有分表数是不止2位的
dbName = fmt.Sprintf("messsage_%v", id%1000/100)
tbName = fmt.Sprintf("message_%v", id%model.TotalTableMessage)

Expand Down

0 comments on commit 4273940

Please sign in to comment.