feat:通过使用--table_prefix 给表名加前缀
使得:
func (obj *_SymbolMgr) GetTableName() string {
return "symbol"
}
变成:
func (obj *_SymbolMgr) GetTableName() string {
return "tableprefix.symbol"
}
并在源头确定表名:tableprefix.symbol.
即真正执行mysql语句的时候,会按照tableprefix.symbol这个表名去执行。
This commit is contained in:
11
data/view/model/common.go
Normal file → Executable file
11
data/view/model/common.go
Normal file → Executable file
@@ -47,6 +47,17 @@ func CapLowercase(name string) string { // IDAPIID == > idAPIID
|
||||
return FilterKeywords(re)
|
||||
}
|
||||
|
||||
// GetTablePrefixName 获取带表前缀名字的tablename
|
||||
func GetTablePrefixName(name string) string { //
|
||||
tablePrefix := config.GetTablePrefix()
|
||||
//如果设置了表前缀
|
||||
if tablePrefix != "" {
|
||||
return fmt.Sprintf("%v.%v", tablePrefix, name)
|
||||
}
|
||||
|
||||
return name
|
||||
}
|
||||
|
||||
func FilterKeywords(src string) string {
|
||||
if tools.IsKeywords(src) {
|
||||
return "_" + src
|
||||
|
||||
Reference in New Issue
Block a user