1305 Commits

Author SHA1 Message Date
Ian Tan
505ecd17d3 Pass Stmt directly to SqlmockQuery 2017-11-23 17:27:59 +08:00
Ian Tan
e89019d178 Remove unnecessary Set 2017-11-23 17:26:24 +08:00
Ian Tan
1a384b3c0c Use callbacks to record sql instead 2017-11-23 17:25:40 +08:00
Ian Tan
c2a28c63c3 Fix mock preload many2many generating empty relation rows 2017-11-22 20:53:49 +08:00
Ian Tan
8cf623a01f Minor clean up 2017-11-22 15:48:15 +08:00
Ian Tan
a0b70669e7 Support mock has one 2017-11-22 15:44:06 +08:00
Ian Tan
8ae27d7ec7 Add partial support for many_to_many 2017-11-22 15:23:02 +08:00
Ian Tan
d28ab5ae89 Add back AssertExpectations 2017-11-22 09:47:47 +08:00
Ian Tan
7aa08b9014 Refactor code for extracting has_many relations 2017-11-21 19:32:17 +08:00
Ian Tan
b06542dc77 Support preloading 2017-11-21 19:02:54 +08:00
Ian Tan
da8c7c1802 Add noop db driver 2017-11-21 17:10:10 +08:00
Ian Tan
486fb73ee5 Add documentation to prevent go lint from complaining 2017-11-21 12:26:18 +08:00
Ian Tan
e9a29091fa Clean up debug code 2017-11-20 18:41:06 +08:00
Ian Tan
afe269ec7d Support slice value -> sql.Rows 2017-11-20 18:38:57 +08:00
Ian Tan
b4591d4db8 Add naive get rows function 2017-11-20 16:04:38 +08:00
Ian Tan
a4ba25028d Add Value() method to gorm_test.Num to prevent scan error 2017-11-20 16:02:40 +08:00
Ian Tan
62740e8e1e Add docs 2017-11-20 10:25:12 +08:00
Ian Tan
8c06f3ff4f Fix variadic arguments 2017-11-18 21:23:55 +08:00
Ian Tan
6a1b81b18b Escape query string and assert err == nil 2017-11-18 19:24:45 +08:00
Ian Tan
ae219db84b Add method to assert all expectations 2017-11-18 19:11:21 +08:00
Ian Tan
475ba3db3e Proof of concept using DB.logger 2017-11-18 19:06:00 +08:00
Ian Tan
5520530799 Fix some go lint errors 2017-11-18 16:37:14 +08:00
Ian Tan
90528be927 Implement private clone method to support fluent API 2017-11-17 18:29:31 +08:00
Ian Tan
b9fc77cb77 Rename files 2017-11-17 17:24:57 +08:00
Ian Tan
5505f2ee76 Remove asserter interface 2017-11-17 17:24:35 +08:00
Ian Tan
27ec78afaa Remove Asserter interface and combine its functionality into Adapter 2017-11-17 17:20:42 +08:00
Ian Tan
71174be05a Rename TestHelper to Expecter and simplify factory function(s) 2017-11-17 17:19:49 +08:00
Ian Tan
36170724dd Refactor mock connection open/close logic 2017-11-17 12:29:06 +08:00
Ian Tan
f5319a00fa Add NewDefaultTestHelper func 2017-11-17 12:10:24 +08:00
Ian Tan
c3e927ba8b Reorganise code structure 2017-11-17 11:55:19 +08:00
Ian Tan
eb418da347 Use github.com/jinzhu/gorm 2017-11-17 11:44:56 +08:00
Ian Tan
85b621bf4e Use same helper and mockDb 2017-11-16 18:54:14 +08:00
Ian Tan
7b6f227136 Add Close method to TestHelper 2017-11-16 18:53:54 +08:00
Ian Tan
fb65f6708c Groundwork for TestHelper 2017-11-16 18:40:49 +08:00
Aetheus
0a51f6cdc5 add JSONB type (#1626)
* add JSONB type

* add comments to satisfy gofmt
2017-10-10 08:28:39 -05:00
Konrad Kleine
9c9de89686 Use log.PrintX instead of fmt.PrintX (#1634) 2017-10-10 08:04:23 -05:00
Horacio Duran
3a9e91ab37 Correct ModifyColumn SQL syntax. (#1614)
* Correct ModifyColumn SQL syntax.

The generated SQL for ModifyColumn was:

`ALTER TABLE "tablename" MODIFY "columname" type`

But should have been:

`ALTER TABLE "tablename" ALTER COLUMN "columname" TYPE type`

since Modify does not seem to be entirely compatible with all Engines

* Test ModifyColumn

* Skip ModifyColumnType test on incompatible DBs

Some DB Engines don't fully support alter table so we skip
when the dialect does not correspond to one of the ones that
are known to support it.
2017-09-28 22:48:21 +08:00
Cedric GESTES
b1885a643b Support cloudsqlpostgres dialect (#1577)
This is needed for proper cloud sql proxy.

see https://github.com/GoogleCloudPlatform/cloudsql-proxy and https://github.com/GoogleCloudPlatform/cloudsql-proxy/blob/master/proxy/dialers/postgres/hook_test.go for details.
2017-09-04 22:39:19 +08:00
Domen Ipavec
c0ac6a7d50 Do not ignore order on distinct query (#1570) 2017-09-04 22:35:37 +08:00
Teppei Fukuda
6e456250f7 Erros skip nil in Add function (#1566) 2017-09-04 22:25:57 +08:00
Dhiver
981d5db663 Fix postgres dialect UUID sqlType evaluation (#1564) 2017-09-04 22:23:42 +08:00
Lukas Dietrich
750fd9030a Fix postgres dialect for dbs with multiple schemas (#1558)
If a postgres database contains more than one
schema methods like HasTable(...) would return
true even if the current schema does not contain a
table with that name.
2017-09-04 22:22:02 +08:00
Jinzhu
c3bb6aaa82 Fix QueryExpr tests 2017-08-11 23:24:00 +08:00
Jinzhu
e5432b14d2 Add QueryExpr, thanks @ManReinsp for PR #1548 2017-08-11 18:41:04 +08:00
Jinzhu
d61b7db8fa Fix postgres tests 2017-08-11 18:03:32 +08:00
Jinzhu
969ab67636 [mssql] Fix save time struct's timezone 2017-08-11 17:18:49 +08:00
Kyle Spraggs
6f64b8610d Update callback_query_preload.go (#1553) 2017-08-02 07:05:11 +08:00
Jinzhu
35fb16eeba Don't overwrite existing timestamp when creating 2017-07-31 17:26:36 +08:00
Ivan Valkov
5b8c0dd6b9 Changed the type of uint32 from integer to bigint in postgres (#1536)
The integer type in postgres is 4 bytes. Since it is also signed, when using uint32 with high bit set you will get:
`pq: value "2854263694" is out of range for type integer`
To prevent this uint32 should be bigint in postgres.
2017-07-23 16:05:43 +08:00
liu-xuewen
10e217e2bc Print affected rows (#1541)
* fix better

* add the rows number that the sql result affected or returned
2017-07-23 16:04:22 +08:00