12 Commits

Author SHA1 Message Date
Joel Feinstein
d461455cc4 Merge 0d6f01d340ff3792ee61aec1fd5c7b45e95018ee into a4e0ef6509b42be2360e339da12c8aaaf94aac12 2014-11-25 07:33:02 +00:00
Jinzhu
1aaac379ae Fix tests for mysql, postgres 2014-11-24 18:16:07 +08:00
jnfeinstein
0d6f01d340 Create empty slice when records are not found.
There is a gotcha in golang (go figure!) resulting from the
difference between a nil slice and an empty slice. While the length
of both are 0, the JSON encoder will interpret the nil slice as
'null' and the empty slice as '[]'. Other libraries (i.e. ActiveRecord)
will return an empty array when no values are found. I have found
that this translates into better client-side code, since you don't
have to protect against null arrays.

See 'http://danott.co/posts/json-marshalling-empty-slices-to-empty-arrays-in-go.html'
for more information.
2014-11-22 02:19:40 -08:00
jnfeinstein
429a100856 Add additional methods of specifying the 'select' portion of a query.
This commit adds more ways of specifying selects:

-) You can now pass in a []string.  This is mostly for convenience,
since you may want to dynamically create a list of fields to be
selected.

-) You can now use variables.  This is important because a select
could take user input.  For example, finding a MAX between a record
and a given number could be easily done using select, and then
you don't have to process anything in backend logic.  This is also
necessary to use postgres text search capabilities (which actaully
play nicely with the rest of gorm).

-) You can now chain select calls.  This could be useful in
conjunction with gorm's scopes functionality.
2014-11-17 07:36:26 -05:00
Paolo Galeone
c108cf022b Add support for signed and unsigned integer types as primary key type 2014-10-22 17:33:13 +02:00
Jinzhu
5eeff5d38f Fix some errors for the mssql support pull request 2014-09-19 21:49:04 +08: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
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
468e54f0ee Refact tests 2014-07-29 16:04:40 +08:00
Jinzhu
cb7d545ac0 Refact tests 2014-07-29 11:38:28 +08:00