Commit Graph

111 Commits

Author SHA1 Message Date
Jinzhu 331d8ceabd Don't overwrite primary key if already it is already exist 2015-06-01 11:09:58 +08:00
Jay Taylor dcc06e22f7 FoundationDB dialect layer and compatibility updates. 2015-03-24 10:35:19 -07:00
Jinzhu ad251b9deb Create with Select 2015-03-12 17:47:31 +08:00
Jinzhu 4e8d43dd4f Refactor check HasTable, HasColumn 2015-02-28 17:01:27 +08:00
Jinzhu 73b6f0eace Linting according to golint 2015-02-17 08:34:01 +08:00
Jinzhu a4e0ef6509 Refactor reuse existing database connection 2014-11-25 15:21:28 +08:00
jnfeinstein 1d6b59f223 Allow .Open to reuse existing database connections.
This commit allows you to pass a string or an existing database
connection as the source for gorm. The dialect is still required
because a) there is no common reference to it as far as i know, and
b) gorm allows the dialect to differ from the driver. So, for the sake
of simplicity, you still have to specity the dialect.

This is useful if you have an existing transaction, but still
want to use gorm to format your queries.

This is dependent on the defintion of DB in pkg database/sql having
the field 'dsn', which is the database source, obtained via reflect.
2014-11-25 15:21:28 +08:00
Paolo Galeone 064d91335b Add default values support ( https://github.com/jinzhu/gorm/issues/251 ) 2014-11-15 18:32:35 +01:00
Jinzhu 5eeff5d38f Fix some errors for the mssql support pull request 2014-09-19 21:49:04 +08:00
Joel Trost a6b243a3e9 fix for bad rebase 2014-09-16 14:49:29 -07:00
Joel Trost 6b7d0879c5 Ran gofmt and removed panic statements
Unnecessary panics in create_test and delete_test removed
2014-09-16 14:24:55 -07:00
Joel Trost f79e1a2ef6 GORM support for MSSQL, passes all tests 2014-09-16 14:21:35 -07:00
Jinzhu e9ecf9c1aa Fix HasTable tests 2014-08-30 21:43:52 +08:00
Robert B Gordon bc616fafbf Fix the HasTable test, for real. 2014-08-29 09:53:12 -05:00
Jinzhu 43be73504f Merge pull request #210 from rbg/master
HasTable Test should clean up.
2014-08-29 22:30:19 +08:00
Robert B Gordon 52de7419f2 HasTable Test should clean up. 2014-08-29 08:57:38 -05:00
Jinzhu 80b563e312 Merge pull request #209 from rbg/master
Add HasTable()
2014-08-29 13:57:20 +08:00
Robert B Gordon 4ee47c9228 add test for HasTable() 2014-08-29 00:51:45 -05:00
Jinzhu 423d9496c1 update tests 2014-08-28 16:14:44 +08:00
Jinzhu 39ac95adbb Add InstanceSet, InstanceGet fomr Scope 2014-08-20 17:05:02 +08:00
Jinzhu 62fd13e04e Refact tests 2014-07-29 16:25:38 +08:00
Jinzhu 468e54f0ee Refact tests 2014-07-29 16:04:40 +08:00
Jinzhu cb7d545ac0 Refact tests 2014-07-29 11:38:28 +08:00
Jinzhu 11dc47587c Support inline condition when Delete 2014-07-24 18:30:12 +08:00
Vytautas Šaltenis 6da7e8c64e Fix couple misleading test failure messages 2014-07-12 13:37:58 +03:00
Vytautas Šaltenis 78948f1b7f Fix couple cosmetic typos 2014-07-12 13:37:58 +03:00
Jinzhu 3bd5131132 Support slice of pointers 2014-07-08 10:45:31 +08:00
Jinzhu 29ac192090 Add Compatibility Mode 2014-07-02 17:55:21 +08:00
Jinzhu a89500c855 Add no permission message when fail to create hstore extension 2014-06-14 10:54:14 +08:00
Vladimir Garvardt d2e526bc2d db.Create() for force insert with predefined primary key 2014-06-12 00:51:43 +04:00
Jinzhu bab148f90c Fix RowsAffected tests 2014-06-09 08:19:24 +08:00
Can Yucel 5f0e640f3d add postgres hstore type support 2014-06-07 20:36:48 -07:00
Jinzhu f32fa0cb6e Add RowsAffected for DB 2014-06-05 17:58:14 +08:00
Jinzhu 319af32c78 Return RecordNotFound error when no record found for slice 2014-06-05 17:15:25 +08:00
Vladimir Garvardt d1dc0ccbef AddUniqueIndex 2014-06-01 02:35:56 +04:00
Vladimir Garvardt cdce84fd1a AddIndex for multiple columns 2014-06-01 02:26:17 +04:00
Jinzhu 452123479e Remove sql string's validation check 2014-04-30 11:53:07 +08:00
Jinzhu 1120451108 Use sqlite as default test database 2014-04-29 16:02:18 +08:00
Jinzhu 514a32e547 Fix imported package name 2014-04-29 15:21:43 +08:00
Paolo Galeone cc3ebd34de Add support to fields with double quotes 2014-04-28 22:37:45 +02:00
Jinzhu d6d83b0cde Fix invalid SQL issue 2014-04-28 16:52:01 +08:00
Jinzhu fd3ce3b39a Add method to close gorm db connection 2014-04-24 10:55:17 +08:00
Xavier Dumesnil 2b7306aca1 Fix typos 2014-04-11 09:58:23 +02:00
Xavier Dumesnil 5e62e7fdad Include scope.TableName() in ORDER statement for First() & Last() 2014-04-10 16:29:09 +02:00
Jinzhu 1a5a4b707d Use offical gorm package in tests 2014-04-06 18:04:10 +08:00
Paolo Galeone bcb1ca67c0 Add support for primary key different from id 2014-04-06 04:10:45 +02:00
Jinzhu 22cf9719bf update test 2014-03-26 11:02:17 +08:00
Jinzhu 663c06cfb1 Add test for anonymous scanner 2014-03-26 10:31:02 +08:00
Jinzhu 1949baf5c8 Test Related with search conditions 2014-03-26 08:48:40 +08:00
Jinzhu d7d9e24e1e Add test for anonymous field 2014-03-26 08:36:17 +08:00
Timothy Stranex 42448cb5d6 Add DB.CommonDB() instead of DB.Tx(), as discussed in the PR thread. 2014-03-17 12:08:44 +02:00
Timothy Stranex a336f51444 Add DB.Tx() method to provice access to the underlying sql.Tx instance. 2014-03-16 18:24:32 +02:00
Jinzhu d232c69369 Fix exception in mysql 2014-03-16 10:57:38 +08:00
Jinzhu e6c953dd4c Support custom types from base types 2014-03-16 09:58:32 +08:00
Jinzhu dc2f27401e Test search data using time with zone 2014-03-15 10:41:12 +08:00
Jinzhu 844a0ddfcc update tests for time with zone 2014-03-15 10:31:26 +08:00
Jinzhu 7bbf71fb29 Add tests to make sure time with zone won't be changed after save 2014-03-15 10:17:43 +08:00
Jinzhu 1086009fce Check if value is struct before check Field 2014-03-11 10:09:16 +08:00
Jinzhu 2c33502503 Add tests for updated_at will be updated when update value with Assign 2014-02-18 10:03:14 +08:00
Jinzhu c25f26149e Fix comparing uncomparable type error 2014-01-30 16:41:10 +08:00
Jinzhu 4c368be254 rename gorm_test to main_test 2014-01-28 16:21:02 +08:00