Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit 57a7e44

Browse files
authored
Use strings.Builder instead of builder.StringBuilder (#1417)
* use strings.Builder instead of builder.StringBuilder * fix dependency * fix dependency
1 parent 61f1d19 commit 57a7e44

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

engine.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ func (engine *Engine) Quote(value string) string {
190190
return value
191191
}
192192

193-
buf := builder.StringBuilder{}
193+
buf := strings.Builder{}
194194
engine.QuoteTo(&buf, value)
195195

196196
return buf.String()
197197
}
198198

199199
// QuoteTo quotes string and writes into the buffer
200-
func (engine *Engine) QuoteTo(buf *builder.StringBuilder, value string) {
200+
func (engine *Engine) QuoteTo(buf *strings.Builder, value string) {
201201
if buf == nil {
202202
return
203203
}

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module github.com/go-xorm/xorm
22

3+
go 1.11
4+
35
require (
46
github.com/cockroachdb/apd v1.1.0 // indirect
57
github.com/denisenkom/go-mssqldb v0.0.0-20190707035753-2be1aa521ff4
@@ -14,6 +16,6 @@ require (
1416
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
1517
github.com/stretchr/testify v1.3.0
1618
github.com/ziutek/mymysql v1.5.4
17-
xorm.io/builder v0.3.5
19+
xorm.io/builder v0.3.6-0.20190906062455-b937eb46ecfb
1820
xorm.io/core v0.7.0
1921
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
162162
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
163163
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
164164
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
165-
xorm.io/builder v0.3.5 h1:EilU39fvWDxjb1cDaELpYhsF+zziRBhew8xk4pngO+A=
166-
xorm.io/builder v0.3.5/go.mod h1:ZFbByS/KxZI1FKRjL05PyJ4YrK2bcxlUaAxdum5aTR8=
165+
xorm.io/builder v0.3.6-0.20190906062455-b937eb46ecfb h1:2idZcp79ldX5qLeQ6WKCdS7aEFNOMvQc9wrtt5hSRwM=
166+
xorm.io/builder v0.3.6-0.20190906062455-b937eb46ecfb/go.mod h1:LEFAPISnRzG+zxaxj2vPicRwz67BdhFreKg8yv8/TgU=
167167
xorm.io/core v0.7.0 h1:hKxuOKWZNeiFQsSuGet/KV8HZ788hclvAl+7azx3tkM=
168168
xorm.io/core v0.7.0/go.mod h1:TuOJjIVa7e3w/rN8tDcAvuLBMtwzdHPbyOzE6Gk1EUI=

statement.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ func (statement *Statement) OrderBy(order string) *Statement {
695695

696696
// Desc generate `ORDER BY xx DESC`
697697
func (statement *Statement) Desc(colNames ...string) *Statement {
698-
var buf builder.StringBuilder
698+
var buf strings.Builder
699699
if len(statement.OrderStr) > 0 {
700700
fmt.Fprint(&buf, statement.OrderStr, ", ")
701701
}
@@ -707,7 +707,7 @@ func (statement *Statement) Desc(colNames ...string) *Statement {
707707

708708
// Asc provide asc order by query condition, the input parameters are columns.
709709
func (statement *Statement) Asc(colNames ...string) *Statement {
710-
var buf builder.StringBuilder
710+
var buf strings.Builder
711711
if len(statement.OrderStr) > 0 {
712712
fmt.Fprint(&buf, statement.OrderStr, ", ")
713713
}
@@ -736,7 +736,7 @@ func (statement *Statement) Table(tableNameOrBean interface{}) *Statement {
736736

737737
// Join The joinOP should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN
738738
func (statement *Statement) Join(joinOP string, tablename interface{}, condition string, args ...interface{}) *Statement {
739-
var buf builder.StringBuilder
739+
var buf strings.Builder
740740
if len(statement.JoinStr) > 0 {
741741
fmt.Fprintf(&buf, "%v %v JOIN ", statement.JoinStr, joinOP)
742742
} else {
@@ -801,7 +801,7 @@ func (statement *Statement) genColumnStr() string {
801801
return ""
802802
}
803803

804-
var buf builder.StringBuilder
804+
var buf strings.Builder
805805
columns := statement.RefTable.Columns()
806806

807807
for _, col := range columns {
@@ -1118,7 +1118,7 @@ func (statement *Statement) genSelectSQL(columnStr, condSQL string, needLimit, n
11181118
}
11191119
}
11201120

1121-
var buf builder.StringBuilder
1121+
var buf strings.Builder
11221122
fmt.Fprintf(&buf, "SELECT %v%v%v%v%v", distinct, top, columnStr, fromStr, whereStr)
11231123
if len(mssqlCondi) > 0 {
11241124
if len(whereStr) > 0 {

0 commit comments

Comments
 (0)