小优
This commit is contained in:
parent
2a68b73773
commit
2aacb682e1
|
@ -95,3 +95,34 @@ func TestBuilder_WriteString(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkBuilder_SprintfXX(b *testing.B) {
|
||||
s := NewBuilder()
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.Sprintf("%s %s %s", "a", "b", "c")
|
||||
_ = s.String()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSPrintfXX(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = fmt.Sprintf("%s %s %s", "a", "b", "c")
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkStrJoinXX(b *testing.B) {
|
||||
s := strings.Builder{}
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.WriteString("a ")
|
||||
s.WriteString("b ")
|
||||
s.WriteString("c ")
|
||||
_ = s.String()
|
||||
}
|
||||
}
|
||||
func BenchmarkBuilderJoinXX(b *testing.B) {
|
||||
s := NewBuilder()
|
||||
for i := 0; i < b.N; i++ {
|
||||
s.WriteString("a ", "b ", "c")
|
||||
_ = s.String()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/fthvgb1/wp-go/helper/slice"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -108,7 +107,9 @@ func (w SqlBuilder) ParseWhere(in *[][]any) (string, []any, error) {
|
|||
st = strings.TrimRight(st, "and ")
|
||||
s.Reset()
|
||||
s.WriteString(st)
|
||||
s.WriteString(fmt.Sprintf(" %s ", ss[start]))
|
||||
s.WriteString(" ")
|
||||
s.WriteString(ss[start])
|
||||
s.WriteString(" ")
|
||||
}
|
||||
if i == 0 {
|
||||
s.WriteString("( ")
|
||||
|
|
Loading…
Reference in New Issue
Block a user