16 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
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