Commit Graph

1005 Commits

Author SHA1 Message Date
Jinzhu d57867eb46 Make Replace support other associations 2015-12-25 15:49:41 +08:00
Jinzhu 0ce635cc67 Add Append support for other associations 2015-12-25 15:25:37 +08:00
Jinzhu 4677215ef4 Fix get type Name from scope 2015-12-25 12:20:45 +08:00
Jinzhu f8c3ad6af3 Format time first when testing 2015-12-25 11:50:55 +08:00
Jinzhu 4a821a5bef Merge pull request #768 from pwaller/patch-1
Give (*ModelStruct).TableName() a pointer receiver
2015-12-24 08:22:35 +08:00
Peter Waller 5ba59aec5f Give (*ModelStruct).TableName() a pointer receiver
There was a data race caused by the copy of the ModelStruct. See #723.

Fixes #723.
2015-12-23 10:42:03 +00:00
Jinzhu d209be3138 Merge pull request #767 from levinalex/patch-1
clean up wording in README
2015-12-18 20:17:59 +08:00
Levin Alexander 2f85c0e4d6 clean up wording in README
made the paragraph about transactions in callbacks more straightforward
2015-12-18 11:50:11 +01:00
Jinzhu e541ca5cdf Fix DropTableIfExists with string 2015-12-16 21:00:56 +08:00
Richard Knop 39e6f58111 There was still an issue with preloading and pointers.
This was actually broken with the refactoring. I added a test to catch
the other place the error was occuring. See the new
TestManyToManyPreloadForNestedPointer test in preload_test.go.
2015-12-16 17:30:58 +08:00
Jinzhu c6a22c5096 Refact fix invalid zero value for Preload 2015-12-16 10:40:57 +08:00
Jinzhu 861c477a33 Test Preload won't panic when nothing found 2015-12-16 10:35:22 +08:00
Jinzhu b2a66e79e8 Merge branch 'RichardKnop-bugfix/preload_indirect_zero_value_check' 2015-12-16 10:27:09 +08:00
Jinzhu 15169e635a Add two more nested many2many preload tests 2015-12-16 10:25:07 +08:00
Richard Knop e69ffaa9c4 Fixed a bug with invalid zero value in preload
When using pointers in model structs, there is an edge case.

When using preload to eagerly preload a many to many relationship and
the main row is not found by a primary key, use of reflect.Indirect in
preload.go results in a zero value and the subsequent call to
FieldByName panics the program.
2015-12-16 00:18:39 +08:00
Jinzhu ba694926d0 Create composite primary key for join table 2015-12-11 12:22:09 +08:00
Jinzhu 341703ed5d Scan value into ignored fields if there is no ambiguity 2015-12-11 11:45:22 +08:00
Jinzhu 8ee49893d1 Merge pull request #750 from lcowell/better_field_error
provide user with more descriptive error message
2015-12-09 10:44:54 +08:00
Jinzhu 807ed63cfe Fix pollute model's fields with join table's values 2015-12-09 10:40:12 +08:00
Luke Cowell fc42a1bbf3 provide user with more descriptive error message 2015-12-04 14:56:21 -08:00
Jinzhu 4c1a78bab7 Don't query all columns out from database after create, but only those has default value 2015-12-04 18:41:28 +08:00
Jinzhu 84c6b46011 Update inflection address 2015-12-03 15:18:42 +08:00
Jinzhu c0b9e3af82 Merge branch 'otiai10-feature/id-but-not-autoincremental' 2015-11-22 09:35:43 +08:00
Jinzhu ea83dec214 Use false to decline antuincrement 2015-11-22 09:35:18 +08:00
otiai10 ba12202af2 Enable to decline antuincrement on ID field 2015-11-21 18:15:47 +09:00
Jinzhu 2f9abdcf02 Fix preload many2many problem when no search results, #688 2015-11-16 12:20:00 +08:00
Jinzhu edee5f5b75 Merge pull request #720 from jseriff/master
Modify count detection regex to match parenthesis instead of starting a capture.
2015-11-16 11:18:52 +08:00
Jinzhu e7d209d71b Add Contributors link 2015-11-16 10:59:24 +08:00
Jinzhu 903e2db911 Add CONTRIBUTING.md 2015-11-16 10:57:12 +08:00
Jason Seriff a3c1fda757 Modify count regex to match parenthesis instead of starting a capture. Fixes #679 2015-11-10 14:51:16 -06:00
Jinzhu 611e613459 Merge pull request #709 from pacificporter/is_byte_array_or_slice
Fix panic() in isUUID()
2015-11-09 09:24:44 +08:00
Jinzhu 1c22149b3c Merge pull request #717 from brunoksato/master
Break [] byte, I was breaking another case
2015-11-09 09:24:12 +08:00
Bruno Sato b27ac1a996 I was breaking another case
EncryptedPassword []byte         `json:"-" sql:"encrypted_password;not null"`
2015-11-06 18:55:56 -02:00
HARUYAMA Seigo c68a386f91 Fix panic() in isUUID()
value with value.Kind() == reflect.Slice does not have value.Type().Len()
2015-11-01 01:15:06 +09:00
Jinzhu 67f88d977b Merge pull request #708 from pacificporter/is_byte_array_or_slice
Fix SqlTag() in case of ByteSlice
2015-10-31 18:12:38 +08:00
HARUYAMA Seigo 92f9584c83 Fix SqlTag() in case of ByteSlice 2015-10-31 16:23:55 +09:00
Jinzhu 0589d36e64 Merge pull request #706 from sulnedinfind/master
add binary UUID support to postgres
2015-10-29 22:23:35 +08:00
Yegor Wienski 3cb95264df add binary UUID support to postgres
Check if the value is a byte array of 16 bytes and its type is named "uuid" or "guid", and if so, use postgres `uuid` type.
2015-10-28 18:05:09 +03:00
Jinzhu 5f113dcb8d Merge pull request #704 from KarolBedkowski/fix_sqlite_column_detect
sqlite3: fix HasColumn - problem with detecting columns
2015-10-25 18:35:19 +08:00
Karol Będkowski 50e1d6526e sqlite3: fix HasColumn - problem with detecting columns
Handle table definitions like ", \"col"" and ",col".
2015-10-24 14:42:38 +02:00
Jinzhu 484fb30089 Merge pull request #697 from DSchalla/master
Fixed Typo in Default values Section
2015-10-21 11:26:02 +08:00
Daniel Schalla 2a004ca186 Fixed Typo in Default values Section 2015-10-18 17:52:33 +02:00
Jinzhu 96f2bc40c7 Merge pull request #695 from henriquemenezes/master
Fix where clause for string primary key when query value is numeric and starts with zero
2015-10-16 14:01:11 +08:00
Henrique Menezes e68fb8f9e2 Fix where clause for string primary key when query value is numeric and starts with zero 2015-10-16 00:49:47 -03:00
Jinzhu 20e37a0533 Merge pull request #691 from athurg/patch-1
Fix FirstOrXXX access invalid memory address
2015-10-13 00:07:15 +08:00
Athurg Feng f1decc2c3e Fix FirstOrXXX access invalid memory address
*DB is cloned, we should ALWAYS use the cloned pointer instead of original one.
2015-10-12 22:38:41 +08:00
Jinzhu ede940e82d Merge pull request #676 from nkovacs/unused-interface
remove unused tabler interface
2015-10-01 22:16:33 +08:00
Nikola Kovacs c691b33ce5 remove unused tabler interface 2015-10-01 10:25:02 +02:00
Jinzhu 8a2b73723d Better compatibility for complex sql type 2015-10-01 08:06:08 +08:00
Jinzhu eeb9ba2250 Fix query with Joins 2015-10-01 07:43:43 +08:00