12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package sql
- import (
- "fmt"
- "strings"
- )
- type InnerTag struct {
- Name string `gorm:"not null;uniqueIndex;comment:名称"`
- InnerTag string `gorm:"not null;uniqueIndex;comment:项目标签"`
- Meta string `gorm:"type:longText;comment:扩展"`
- }
- const TablePreFix = "cock"
- func tableName(name string) string {
- return fmt.Sprintf("%s%s%s", TablePreFix, tableConnector(), strings.ToLower(name))
- }
- // 分表前缀,留用
- func tablePrefix(authId string) string {
- return ""
- }
- // 分表后缀,留用
- func tableSuffix(authId string) string {
- return ""
- }
- // 分表前连接符,留用
- func tableConnector() string {
- return "_"
- }
- // 分表中间中间连接符,留用
- func tableSeparator() string {
- return ""
- }
- // 获取分表名称
- func getChildTableName(tableName string, authId string) string {
- return fmt.Sprintf("%s%s%s%s%s", tableName, tableConnector(), tablePrefix(authId), tableSeparator(), tableSuffix(authId))
- }
|