Skip to content

Commit

Permalink
Revert "fix builder grow"
Browse files Browse the repository at this point in the history
This reverts commit 80b1beb.
  • Loading branch information
lqs committed Jan 6, 2025
1 parent 80b1beb commit e7c7a9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ func commaTables(scope scope, tables []Table) string {
}

func commaValuesBuilder(scope scope, builder *strings.Builder, values []interface{}) error {
if len(values) == 0 {
return nil
}
builder.Grow(16 * (len(values) + 2)) // hopefully reduce copying
for i, item := range values {
if i > 0 {
builder.WriteString(", ")
Expand Down
4 changes: 2 additions & 2 deletions insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ func (s insertStatus) GetSQL() (string, error) {
if i > 0 {
valuesBuilder.WriteString(", ")
}
valuesBuilder.WriteByte('(')
valuesBuilder.WriteString("(")
if err := commaValuesBuilder(s.scope, &valuesBuilder, model.GetValues()); err != nil {
return "", err
}
valuesBuilder.WriteByte(')')
valuesBuilder.WriteString(")")
}
}
} else {
Expand Down

0 comments on commit e7c7a9f

Please sign in to comment.