Use strings.Builder instead of builder.StringBuilder #1417
|
@ -190,14 +190,14 @@ func (engine *Engine) Quote(value string) string {
|
|||
return value
|
||||
}
|
||||
|
||||
buf := builder.StringBuilder{}
|
||||
buf := strings.Builder{}
|
||||
engine.QuoteTo(&buf, value)
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// QuoteTo quotes string and writes into the buffer
|
||||
func (engine *Engine) QuoteTo(buf *builder.StringBuilder, value string) {
|
||||
func (engine *Engine) QuoteTo(buf *strings.Builder, value string) {
|
||||
if buf == nil {
|
||||
return
|
||||
}
|
||||
|
|
4
go.mod
4
go.mod
|
@ -1,5 +1,7 @@
|
|||
module github.com/go-xorm/xorm
|
||||
|
||||
go 1.11
|
||||
|
||||
require (
|
||||
github.com/cockroachdb/apd v1.1.0 // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4
|
||||
|
@ -14,6 +16,6 @@ require (
|
|||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
|
||||
github.com/stretchr/testify v1.3.0
|
||||
github.com/ziutek/mymysql v1.5.4
|
||||
xorm.io/builder v0.3.5
|
||||
xorm.io/builder v0.3.6-0.20190906062455-b937eb46ecfb
|
||||
xorm.io/core v0.7.0
|
||||
)
|
||||
|
|
4
go.sum
4
go.sum
|
@ -162,7 +162,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
xorm.io/builder v0.3.5 h1:EilU39fvWDxjb1cDaELpYhsF+zziRBhew8xk4pngO+A=
|
||||
xorm.io/builder v0.3.5/go.mod h1:ZFbByS/KxZI1FKRjL05PyJ4YrK2bcxlUaAxdum5aTR8=
|
||||
xorm.io/builder v0.3.6-0.20190906062455-b937eb46ecfb h1:2idZcp79ldX5qLeQ6WKCdS7aEFNOMvQc9wrtt5hSRwM=
|
||||
xorm.io/builder v0.3.6-0.20190906062455-b937eb46ecfb/go.mod h1:LEFAPISnRzG+zxaxj2vPicRwz67BdhFreKg8yv8/TgU=
|
||||
xorm.io/core v0.7.0 h1:hKxuOKWZNeiFQsSuGet/KV8HZ788hclvAl+7azx3tkM=
|
||||
xorm.io/core v0.7.0/go.mod h1:TuOJjIVa7e3w/rN8tDcAvuLBMtwzdHPbyOzE6Gk1EUI=
|
||||
|
|
10
statement.go
10
statement.go
|
@ -695,7 +695,7 @@ func (statement *Statement) OrderBy(order string) *Statement {
|
|||
|
||||
// Desc generate `ORDER BY xx DESC`
|
||||
func (statement *Statement) Desc(colNames ...string) *Statement {
|
||||
var buf builder.StringBuilder
|
||||
var buf strings.Builder
|
||||
if len(statement.OrderStr) > 0 {
|
||||
fmt.Fprint(&buf, statement.OrderStr, ", ")
|
||||
}
|
||||
|
@ -707,7 +707,7 @@ func (statement *Statement) Desc(colNames ...string) *Statement {
|
|||
|
||||
// Asc provide asc order by query condition, the input parameters are columns.
|
||||
func (statement *Statement) Asc(colNames ...string) *Statement {
|
||||
var buf builder.StringBuilder
|
||||
var buf strings.Builder
|
||||
if len(statement.OrderStr) > 0 {
|
||||
fmt.Fprint(&buf, statement.OrderStr, ", ")
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ func (statement *Statement) Table(tableNameOrBean interface{}) *Statement {
|
|||
|
||||
// Join The joinOP should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN
|
||||
func (statement *Statement) Join(joinOP string, tablename interface{}, condition string, args ...interface{}) *Statement {
|
||||
var buf builder.StringBuilder
|
||||
var buf strings.Builder
|
||||
if len(statement.JoinStr) > 0 {
|
||||
fmt.Fprintf(&buf, "%v %v JOIN ", statement.JoinStr, joinOP)
|
||||
} else {
|
||||
|
@ -801,7 +801,7 @@ func (statement *Statement) genColumnStr() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
var buf builder.StringBuilder
|
||||
var buf strings.Builder
|
||||
columns := statement.RefTable.Columns()
|
||||
|
||||
for _, col := range columns {
|
||||
|
@ -1118,7 +1118,7 @@ func (statement *Statement) genSelectSQL(columnStr, condSQL string, needLimit, n
|
|||
}
|
||||
}
|
||||
|
||||
var buf builder.StringBuilder
|
||||
var buf strings.Builder
|
||||
fmt.Fprintf(&buf, "SELECT %v%v%v%v%v", distinct, top, columnStr, fromStr, whereStr)
|
||||
if len(mssqlCondi) > 0 {
|
||||
if len(whereStr) > 0 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user