Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tools
mattermost
mattermost-server
Commits
04175d36
Commit
04175d36
authored
May 19, 2016
by
Christopher Speller
Committed by
enahum
May 19, 2016
Browse files
Rolling back gorp to earlier version (#3056)
parent
98fa24f2
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
glide.lock
View file @
04175d36
...
...
@@ -17,7 +17,7 @@ imports:
- redis
- internal
- name: github.com/go-gorp/gorp
version:
6a3c8a87d0457cf700e57046c41e19b7cf3c44fa
version:
0c9bc0918534d133cedb439a24adc7cbe66e4a9d
- name: github.com/go-ldap/ldap
version: 0e7db8eb77695b5a952f0e5d78df9ab160050c73
- name: github.com/go-sql-driver/mysql
...
...
glide.yaml
View file @
04175d36
...
...
@@ -7,6 +7,7 @@ import:
-
package
:
github.com/dgryski/dgoogauth
-
package
:
github.com/disintegration/imaging
-
package
:
github.com/go-gorp/gorp
version
:
0c9bc0918534d133cedb439a24adc7cbe66e4a9d
-
package
:
github.com/go-ldap/ldap
-
package
:
github.com/go-sql-driver/mysql
-
package
:
github.com/goamz/goamz
...
...
vendor/github.com/go-gorp/gorp/.gitignore
View file @
04175d36
_test
*.test
_testmain.go
_obj
*~
...
...
vendor/github.com/go-gorp/gorp/.travis.yml
View file @
04175d36
...
...
@@ -24,6 +24,5 @@ before_script:
-
go get github.com/go-sql-driver/mysql
-
go get golang.org/x/tools/cmd/cover
-
go get github.com/mattn/goveralls
-
go get github.com/onsi/ginkgo/ginkgo
script
:
./test_all.sh
vendor/github.com/go-gorp/gorp/dialect_mysql_test.go
deleted
100644 → 0
View file @
98fa24f2
// Copyright 2012 James Cooper. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// Package gorp provides a simple way to marshal Go structs to and from
// SQL databases. It uses the database/sql package, and should work with any
// compliant database/sql driver.
//
// Source code and project home:
// https://github.com/go-gorp/gorp
package
gorp_test
import
(
"database/sql"
"reflect"
"time"
// ginkgo/gomega functions read better as dot-imports.
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/ginkgo/extensions/table"
.
"github.com/onsi/gomega"
"github.com/go-gorp/gorp"
)
var
_
=
Describe
(
"MySQLDialect"
,
func
()
{
var
(
engine
,
encoding
string
dialect
gorp
.
MySQLDialect
)
JustBeforeEach
(
func
()
{
dialect
=
gorp
.
MySQLDialect
{
Engine
:
engine
,
Encoding
:
encoding
,
}
})
DescribeTable
(
"ToSqlType"
,
func
(
value
interface
{},
maxsize
int
,
autoIncr
bool
,
expected
string
)
{
typ
:=
reflect
.
TypeOf
(
value
)
sqlType
:=
dialect
.
ToSqlType
(
typ
,
maxsize
,
autoIncr
)
Expect
(
sqlType
)
.
To
(
Equal
(
expected
))
},
Entry
(
"bool"
,
true
,
0
,
false
,
"boolean"
),
Entry
(
"int8"
,
int8
(
1
),
0
,
false
,
"tinyint"
),
Entry
(
"uint8"
,
uint8
(
1
),
0
,
false
,
"tinyint unsigned"
),
Entry
(
"int16"
,
int16
(
1
),
0
,
false
,
"smallint"
),
Entry
(
"uint16"
,
uint16
(
1
),
0
,
false
,
"smallint unsigned"
),
Entry
(
"int32"
,
int32
(
1
),
0
,
false
,
"int"
),
Entry
(
"int (treated as int32)"
,
int
(
1
),
0
,
false
,
"int"
),
Entry
(
"uint32"
,
uint32
(
1
),
0
,
false
,
"int unsigned"
),
Entry
(
"uint (treated as uint32)"
,
uint
(
1
),
0
,
false
,
"int unsigned"
),
Entry
(
"int64"
,
int64
(
1
),
0
,
false
,
"bigint"
),
Entry
(
"uint64"
,
uint64
(
1
),
0
,
false
,
"bigint unsigned"
),
Entry
(
"float32"
,
float32
(
1
),
0
,
false
,
"double"
),
Entry
(
"float64"
,
float64
(
1
),
0
,
false
,
"double"
),
Entry
(
"[]uint8"
,
[]
uint8
{
1
},
0
,
false
,
"mediumblob"
),
Entry
(
"NullInt64"
,
sql
.
NullInt64
{},
0
,
false
,
"bigint"
),
Entry
(
"NullFloat64"
,
sql
.
NullFloat64
{},
0
,
false
,
"double"
),
Entry
(
"NullBool"
,
sql
.
NullBool
{},
0
,
false
,
"tinyint"
),
Entry
(
"Time"
,
time
.
Time
{},
0
,
false
,
"datetime"
),
Entry
(
"default-size string"
,
""
,
0
,
false
,
"varchar(255)"
),
Entry
(
"sized string"
,
""
,
50
,
false
,
"varchar(50)"
),
Entry
(
"large string"
,
""
,
1024
,
false
,
"text"
),
)
Describe
(
"AutoIncrStr"
,
func
()
{
It
(
"returns the auto increment string"
,
func
()
{
Expect
(
dialect
.
AutoIncrStr
())
.
To
(
Equal
(
"auto_increment"
))
})
})
Describe
(
"AutoIncrBindValue"
,
func
()
{
It
(
"returns the value used to bind the auto-increment value"
,
func
()
{
Expect
(
dialect
.
AutoIncrBindValue
())
.
To
(
Equal
(
"null"
))
})
})
Describe
(
"AutoIncrInsertSuffix"
,
func
()
{
It
(
"returns the suffix needed for auto-incrementing"
,
func
()
{
Expect
(
dialect
.
AutoIncrInsertSuffix
(
nil
))
.
To
(
BeEmpty
())
})
})
Describe
(
"CreateTableSuffix"
,
func
()
{
Context
(
"with an empty engine"
,
func
()
{
BeforeEach
(
func
()
{
engine
=
""
encoding
=
"foo"
})
It
(
"panics"
,
func
()
{
Expect
(
func
()
{
dialect
.
CreateTableSuffix
()
})
.
To
(
Panic
())
})
})
Context
(
"with an empty encoding"
,
func
()
{
BeforeEach
(
func
()
{
engine
=
"foo"
encoding
=
""
})
It
(
"panics"
,
func
()
{
Expect
(
func
()
{
dialect
.
CreateTableSuffix
()
})
.
To
(
Panic
())
})
})
Context
(
"with an engine and an encoding"
,
func
()
{
BeforeEach
(
func
()
{
engine
=
"foo"
encoding
=
"bar"
})
It
(
"returns a valid suffix"
,
func
()
{
Expect
(
dialect
.
CreateTableSuffix
())
.
To
(
Equal
(
" engine=foo charset=bar"
))
})
})
})
Describe
(
"CreateIndexSuffix"
,
func
()
{
It
(
"returns the suffix for creating indexes"
,
func
()
{
Expect
(
dialect
.
CreateIndexSuffix
())
.
To
(
Equal
(
"using"
))
})
})
Describe
(
"DropIndexSuffix"
,
func
()
{
It
(
"returns the suffix for deleting indexes"
,
func
()
{
Expect
(
dialect
.
DropIndexSuffix
())
.
To
(
Equal
(
"on"
))
})
})
Describe
(
"TruncateClause"
,
func
()
{
It
(
"returns the clause for truncating a table"
,
func
()
{
Expect
(
dialect
.
TruncateClause
())
.
To
(
Equal
(
"truncate"
))
})
})
Describe
(
"BindVar"
,
func
()
{
It
(
"returns the variable binding sequence"
,
func
()
{
Expect
(
dialect
.
BindVar
(
0
))
.
To
(
Equal
(
"?"
))
})
})
PDescribe
(
"InsertAutoIncr"
,
func
()
{})
Describe
(
"QuoteField"
,
func
()
{
It
(
"returns the argument quoted as a field"
,
func
()
{
Expect
(
dialect
.
QuoteField
(
"foo"
))
.
To
(
Equal
(
"`foo`"
))
})
})
Describe
(
"QuotedTableForQuery"
,
func
()
{
var
(
schema
,
table
string
quotedTable
string
)
JustBeforeEach
(
func
()
{
quotedTable
=
dialect
.
QuotedTableForQuery
(
schema
,
table
)
})
Context
(
"using the default schema"
,
func
()
{
BeforeEach
(
func
()
{
schema
=
""
table
=
"foo"
})
It
(
"returns just the table"
,
func
()
{
Expect
(
quotedTable
)
.
To
(
Equal
(
"`foo`"
))
})
})
Context
(
"with a supplied schema"
,
func
()
{
BeforeEach
(
func
()
{
schema
=
"foo"
table
=
"bar"
})
It
(
"returns the schema and table"
,
func
()
{
Expect
(
quotedTable
)
.
To
(
Equal
(
"foo.`bar`"
))
})
})
})
Describe
(
"IfSchemaNotExists"
,
func
()
{
It
(
"appends 'if not exists' to the command"
,
func
()
{
Expect
(
dialect
.
IfSchemaNotExists
(
"foo"
,
"bar"
))
.
To
(
Equal
(
"foo if not exists"
))
})
})
Describe
(
"IfTableExists"
,
func
()
{
It
(
"appends 'if exists' to the command"
,
func
()
{
Expect
(
dialect
.
IfTableExists
(
"foo"
,
"bar"
,
"baz"
))
.
To
(
Equal
(
"foo if exists"
))
})
})
Describe
(
"IfTableNotExists"
,
func
()
{
It
(
"appends 'if not exists' to the command"
,
func
()
{
Expect
(
dialect
.
IfTableNotExists
(
"foo"
,
"bar"
,
"baz"
))
.
To
(
Equal
(
"foo if not exists"
))
})
})
})
vendor/github.com/go-gorp/gorp/dialect_postgres.go
View file @
04175d36
...
...
@@ -78,7 +78,7 @@ func (d PostgresDialect) AutoIncrBindValue() string {
}
func
(
d
PostgresDialect
)
AutoIncrInsertSuffix
(
col
*
ColumnMap
)
string
{
return
" returning "
+
d
.
QuoteField
(
col
.
ColumnName
)
return
" returning "
+
col
.
ColumnName
}
// Returns suffix
...
...
@@ -123,7 +123,7 @@ func (d PostgresDialect) InsertAutoIncrToTarget(exec SqlExecutor, insertSql stri
}
func
(
d
PostgresDialect
)
QuoteField
(
f
string
)
string
{
return
`"`
+
f
+
`"`
return
`"`
+
strings
.
ToLower
(
f
)
+
`"`
}
func
(
d
PostgresDialect
)
QuotedTableForQuery
(
schema
string
,
table
string
)
string
{
...
...
vendor/github.com/go-gorp/gorp/gorp_suite_test.go
deleted
100644 → 0
View file @
98fa24f2
package
gorp_test
import
(
.
"github.com/onsi/ginkgo"
.
"github.com/onsi/gomega"
"testing"
)
func
TestGorp
(
t
*
testing
.
T
)
{
RegisterFailHandler
(
Fail
)
RunSpecs
(
t
,
"Gorp Suite"
)
}
vendor/github.com/go-gorp/gorp/gorp_test.go
View file @
04175d36
This diff is collapsed.
Click to expand it.
vendor/github.com/go-gorp/gorp/test_all.sh
View file @
04175d36
...
...
@@ -5,9 +5,6 @@
coveralls_testflags
=
"-v -covermode=count -coverprofile=coverage.out"
echo
"Running unit tests"
ginkgo
-r
-race
-randomizeAllSpecs
-keepGoing
--
-test
.run TestGorp
echo
"Testing against mysql"
export
GORP_TEST_DSN
=
gorptest/gorptest/gorptest
export
GORP_TEST_DIALECT
=
mysql
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment