代码拉取完成,页面将自动刷新
package dialect
import (
"fmt"
"strings"
)
func NewMappingShenTong() (mapping *SqlMapping) {
// https://blog.csdn.net/asd051377305/article/details/108766792
mapping = &SqlMapping{
dialectType: TypeShenTong,
OwnerNamePackChar: "",
TableNamePackChar: "\"",
ColumnNamePackChar: "\"",
SqlValuePackChar: "'",
SqlValueEscapeChar: "'",
}
appendShenTongSql(mapping)
mapping.PackPageSql = func(selectSql string, pageSize int, pageNo int) (pageSql string) {
pageSql = selectSql + fmt.Sprintf(" LIMIT %d OFFSET %d", pageSize, pageSize*(pageNo-1))
return
}
mapping.PackLimitOffsetSql = func(selectSql string, limit int, offset int) (pageSql string) {
pageSql = selectSql + fmt.Sprintf(" LIMIT %d OFFSET %d", limit, offset)
return
}
/*mapping.ReplaceSqlVariable = func(sqlInfo string, args []interface{}) (variableSql string) {
strList := strings.Split(sqlInfo, "?")
if len(strList) < 1 {
variableSql = sqlInfo
return
}
variableSql = strList[0]
for i := 1; i < len(strList); i++ {
variableSql += ":" + strconv.Itoa(i)
variableSql += strList[i]
}
return
}*/
mapping.ReplaceSqlVariable = func(sqlInfo string, args []interface{}) (variableSql string) {
argCount := len(args)
if argCount == 0 {
variableSql = sqlInfo
return
}
variableSql = sqlInfo
for i := 1; i <= argCount; i++ {
variableSql = strings.Replace(variableSql, "?", fmt.Sprintf(":%v", i), 1)
}
return
}
for _, one := range shenTongColumnTypeList {
mapping.AddColumnTypeInfo(one)
}
for _, one := range shenTongIndexTypeList {
mapping.AddIndexTypeInfo(one)
}
return
}
var (
shenTongIndexTypeList []*IndexTypeInfo
)
func appendShenTongIndexType(indexType *IndexTypeInfo) {
shenTongIndexTypeList = append(shenTongIndexTypeList, indexType)
}
func init() {
appendShenTongIndexType(&IndexTypeInfo{Name: "", Format: "INDEX",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
})
appendShenTongIndexType(&IndexTypeInfo{Name: "INDEX", Format: "INDEX",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
})
appendShenTongIndexType(&IndexTypeInfo{Name: "NORMAL", Format: "INDEX",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
})
appendShenTongIndexType(&IndexTypeInfo{Name: "UNIQUE", Format: "UNIQUE",
NotSupportDataTypes: []string{"CLOB", "BLOB"},
IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) {
indexTypeFormat = "UNIQUE INDEX"
return
},
})
appendShenTongIndexType(&IndexTypeInfo{Name: "FULLTEXT", Format: "FULLTEXT",
IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) {
return
},
})
appendShenTongIndexType(&IndexTypeInfo{Name: "SPATIAL", Format: "SPATIAL",
IndexTypeFormat: func(index *IndexModel) (indexTypeFormat string, err error) {
return
},
})
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。