No description
Find a file
2014-08-31 00:03:04 +09:00
.gitignore initial commit 2014-08-29 00:11:18 +09:00
int.go update docs 2014-08-31 00:03:04 +09:00
int_test.go nullable Int, String improvements 2014-08-30 23:53:25 +09:00
LICENSE initial commit 2014-08-29 00:11:18 +09:00
README.md update docs 2014-08-31 00:03:04 +09:00
string.go nullable Int, String improvements 2014-08-30 23:53:25 +09:00
string_test.go nullable Int, String improvements 2014-08-30 23:53:25 +09:00

null GoDoc Coverage

null is a library with opinions on how to deal with nullable SQL and JSON values

String

A nullable string. Implements sql.Scanner, encoding.Marshaler and encoding.TextUnmarshaler, providing support for JSON and XML.

Will marshal to a blank string if null. Blank string input produces a null String. In other words, null values and empty values are considered equivalent.

UnmarshalJSON supports sql.NullString input.

Int

A nullable int64.

Unlike null.String, null.Int will marshal to null if null. Zero input will not produce a null Int.

UnmarshalJSON supports sql.NullInt64 input.

Bugs

json's ",omitempty" struct tag does not work correctly right now. It will never omit a null or empty String. This should be fixed in Go 1.4.

License

BSD