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 5ed35a9

Browse files
authored
Merge branch 'master' into lunny/find_map_test
2 parents a8a84da + d4419ac commit 5ed35a9

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

dialect_postgres.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ func (db *postgres) IsColumnExist(tableName, colName string) (bool, error) {
952952

953953
func (db *postgres) GetColumns(tableName string) ([]string, map[string]*core.Column, error) {
954954
args := []interface{}{tableName}
955-
s := `SELECT column_name, column_default, is_nullable, data_type, character_maximum_length, numeric_precision, numeric_precision_radix ,
955+
s := `SELECT column_name, column_default, is_nullable, data_type, character_maximum_length,
956956
CASE WHEN p.contype = 'p' THEN true ELSE false END AS primarykey,
957957
CASE WHEN p.contype = 'u' THEN true ELSE false END AS uniquekey
958958
FROM pg_attribute f
@@ -987,14 +987,14 @@ WHERE c.relkind = 'r'::char AND c.relname = $1%s AND f.attnum > 0 ORDER BY f.att
987987
col.Indexes = make(map[string]int)
988988

989989
var colName, isNullable, dataType string
990-
var maxLenStr, colDefault, numPrecision, numRadix *string
990+
var maxLenStr, colDefault *string
991991
var isPK, isUnique bool
992-
err = rows.Scan(&colName, &colDefault, &isNullable, &dataType, &maxLenStr, &numPrecision, &numRadix, &isPK, &isUnique)
992+
err = rows.Scan(&colName, &colDefault, &isNullable, &dataType, &maxLenStr, &isPK, &isUnique)
993993
if err != nil {
994994
return nil, nil, err
995995
}
996996

997-
// fmt.Println(args, colName, isNullable, dataType, maxLenStr, colDefault, numPrecision, numRadix, isPK, isUnique)
997+
// fmt.Println(args, colName, isNullable, dataType, maxLenStr, colDefault, isPK, isUnique)
998998
var maxLen int
999999
if maxLenStr != nil {
10001000
maxLen, err = strconv.Atoi(*maxLenStr)

dialect_postgres_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import (
44
"reflect"
55
"testing"
66

7-
"xorm.io/core"
8-
"github.com/jackc/pgx/stdlib"
97
"github.com/stretchr/testify/assert"
8+
"xorm.io/core"
109
)
1110

1211
func TestParsePostgres(t *testing.T) {
@@ -72,10 +71,7 @@ func TestParsePgx(t *testing.T) {
7271
}
7372

7473
// Register DriverConfig
75-
drvierConfig := stdlib.DriverConfig{}
76-
stdlib.RegisterDriverConfig(&drvierConfig)
77-
uri, err = driver.Parse("pgx",
78-
drvierConfig.ConnectionString(test.in))
74+
uri, err = driver.Parse("pgx", test.in)
7975
if err != nil && test.valid {
8076
t.Errorf("%q got unexpected error: %s", test.in, err)
8177
} else if err == nil && !reflect.DeepEqual(test.expected, uri.DbName) {

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)