perf(scan): 使用缓存减少对象扫描

抽取函数,优化变量命名
支持了传入数组类型
This commit is contained in:
2025-11-27 18:24:36 +08:00
parent 581b0b60eb
commit b9413d6c40
7 changed files with 215 additions and 197 deletions

View File

@@ -11,14 +11,14 @@ import (
// buildInsertStatementForSuperTable 构建超级表插入语句
// @param rows 同一超级表下的数据行
// @return 插入语句
func buildInsertStatementForSuperTable(rows ...*TableRowMateria) (string, error) {
func buildInsertStatementForSuperTable(rows ...*TableRowMaterial) (string, error) {
if len(rows) == 0 {
return "", fmt.Errorf("no rows provided for super table insert")
}
var sb strings.Builder
// 格式化标签和值
// 开始格式化标签和值
formattedTagColumns := formatColumns(rows[0].TagColumns...)
formattedTagValues := formatRowValues(rows[0].TagValues...)
formattedColumns := formatColumns(rows[0].Columns...)
@@ -56,7 +56,7 @@ func buildInsertStatementForSuperTable(rows ...*TableRowMateria) (string, error)
// buildInsertStatementForNormalTable 普通表插入构建
// @param data 数据 当前应该是同一个表的
// @return 插入语句 表名1 (列名) VALUES (),()
func buildInsertStatementForNormalTable(rows ...*TableRowMateria) (string, error) {
func buildInsertStatementForNormalTable(rows ...*TableRowMaterial) (string, error) {
if len(rows) == 0 {
return "", fmt.Errorf("no data provided for normal table insert")
}