Commit Graph

1094 Commits

Author SHA1 Message Date
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
Jinzhu 4da2c28d4d Fix data race warning when get cached model struct 2015-10-01 07:09:00 +08:00
Jinzhu 88188b6161 Respect Where when create index 2015-10-01 06:53:15 +08:00
Jinzhu 58596afda1 Replace many2many associations with empty 2015-09-30 21:30:58 +08:00
Jinzhu a480621b76 Fix extra updates when Append associations for many2many 2015-09-30 12:10:22 +08:00
Jinzhu 048963c568 Merge pull request #666 from defend7/sqlite_autoincrement
Support the AUTOINCREMENT keyword on SQLite.
2015-09-28 10:20:17 +08:00
Jinzhu e6ef3818bf Merge pull request #669 from nkovacs/addr-fix
Fix panic: reflect.Value.Addr of unaddressable value
2015-09-28 10:16:36 +08:00
Jinzhu 00fe20f8a8 Merge pull request #672 from ivpusic/master
do not execute buildSelectQuery twice
2015-09-28 10:09:44 +08:00
Ivan Pusic 246383326c do not execute buildSelectQuery twice
if buildSelectQuery() is executed twice, then we get more values in SqlVars than expected
2015-09-28 00:03:51 +02:00
Jinzhu 37bf87aa29 Fix can't load preload fields correctly 2015-09-26 00:41:07 +08:00
Jinzhu 198fc47051 Include all primary fields when build where conditions 2015-09-25 17:14:21 +08:00
Nikola Kovacs a8d7a5fa34 add test for unaddressable value in preload 2015-09-24 14:08:36 +02:00