merge master

This commit is contained in:
John Guo
2025-12-04 20:41:28 +08:00
35 changed files with 59 additions and 45 deletions

View File

@ -155,7 +155,7 @@ func (d *Driver) doMergeInsert(
return batchResult, nil
}
// getPrimaryKeys retrieves the primary key field list of the table.
// getPrimaryKeys retrieves the primary key field names of the table as a slice of strings.
// This method extracts primary key information from TableFields.
func (d *Driver) getPrimaryKeys(ctx context.Context, table string) ([]string, error) {
tableFields, err := d.TableFields(ctx, table)
@ -206,8 +206,7 @@ func parseSqlForMerge(table string,
pattern, table, queryHolderStr, duplicateKeyStr, insertKeyStr, insertValueStr,
strings.Join(updateValues, ","),
)
} else {
// Insert Ignore: INSERT only
return fmt.Sprintf(pattern, table, queryHolderStr, duplicateKeyStr, insertKeyStr, insertValueStr)
}
// Insert Ignore: INSERT only
return fmt.Sprintf(pattern, table, queryHolderStr, duplicateKeyStr, insertKeyStr, insertValueStr)
}