327 Commits

Author SHA1 Message Date
Paolo Galeone
fdd9a52800 Add getPrimaryKey: analize the tag string in the struct fields and find the one marked as primaryKey
Add primaryKey field to scope and uses getPrimaryKey to find the one marked in that way, if present. Otherwise fallback to id

Format code with gofmt

Fixes getPrimaryKey for non struct type

Add tests

add Tests for update a struct
2014-04-06 03:59:48 +02:00
Paolo Galeone
5574d47f1f Update README.md 2014-04-02 10:59:07 +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
Jinzhu
6d48c9357d Merge pull request #77 from tstranex/master
Add DB.Tx() method to provide access to the underlying sql.Tx instance.
2014-03-17 19:45:14 +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
4969fc9cb5 Remove unused Scanner type from dialect 2014-03-16 07:50:57 +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
65e594e2d6 Fix README 2014-03-15 09:05:08 +08:00
Jinzhu
1086009fce Check if value is struct before check Field 2014-03-11 10:09:16 +08:00
Jinzhu
24d527670b Use the same database for Related 2014-03-07 19:08:33 +08:00
Jinzhu
0156c26cfa Merge pull request #64 from fuzzac/master
Fixed double logging of UPDATE and DELETE commands.
2014-02-21 10:29:23 +08:00
unknown
dfb75dc79d Fixed double logging of UPDATE and DELETE commands. 2014-02-19 14:51:14 -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
829158ed2f Format document 2014-01-29 19:20:06 +08:00
Jinzhu
91e937bac1 Add some documents 2014-01-29 19:14:37 +08:00
Jinzhu
5eed96457b rename couple of scope related methods 2014-01-29 12:00:57 +08:00
Jinzhu
241b6bc3b9 refact 2014-01-29 10:35:28 +08:00
Jinzhu
b713479174 change callback names 2014-01-29 10:28:20 +08:00
Jinzhu
e2897f0c9b clone callback when call Callback 2014-01-29 10:25:58 +08:00
Jinzhu
31247c577d update method CombinedConditionSql 2014-01-29 08:55:45 +08:00
Jinzhu
036df5f46b Move scope_database to scope.go 2014-01-28 17:40:09 +08:00
Jinzhu
6f1dd5fae3 API for search 2014-01-28 16:56:51 +08:00
Jinzhu
15583e6017 rename some files 2014-01-28 16:29:42 +08:00
Jinzhu
f1d990e92a rename scope.quote to scope.Quote 2014-01-28 16:22:41 +08:00
Jinzhu
4c368be254 rename gorm_test to main_test 2014-01-28 16:21:02 +08:00
Jinzhu
a2edf56c58 Remove unused codes 2014-01-28 16:06:22 +08:00
Jinzhu
2adbc4b8a6 move all code to scope 2014-01-28 15:54:19 +08:00
Jinzhu
05ce3d3933 related with plugin system 2014-01-28 12:28:44 +08:00
Jinzhu
ae68c0fb47 make count works 2014-01-28 11:38:53 +08:00
Jinzhu
5fd2e0d54f make pluck works 2014-01-28 11:37:32 +08:00
Jinzhu
7a99f37ba4 Make exec works with plugin system 2014-01-28 10:29:12 +08:00
Jinzhu
7bebf685f4 refact 2014-01-28 10:23:31 +08:00
Jinzhu
275de4f133 Add method inlineCondition 2014-01-28 10:06:03 +08:00
Jinzhu
6e848fc987 move row, rows, scan to scope 2014-01-28 09:48:44 +08:00
Jinzhu
549d7a8af2 make first, last works with plugin system 2014-01-28 09:30:30 +08:00
Jinzhu
db68e7a8fe make callback query works 2014-01-28 09:25:30 +08:00
Jinzhu
048b8b6abe make update column works with new plugin system 2014-01-28 08:27:12 +08:00
Jinzhu
506d14a2f2 make callback deletes works 2014-01-27 22:36:08 +08:00
Jinzhu
eab146a275 Add getter setter for scope 2014-01-27 12:02:35 +08:00
Jinzhu
23feade663 use callback update when save 2014-01-27 11:25:55 +08:00
Jinzhu
3981baf65d Make callback create pass all tests 2014-01-27 10:47:37 +08:00