update docs/fix nuller pkg

This commit is contained in:
Greg 2014-08-31 17:36:30 +09:00
parent bd2ece7042
commit 4ac909cd7c
6 changed files with 11 additions and 8 deletions

View file

@ -7,10 +7,10 @@ Types in `null` are treated like zero values in Go: blank string input will prod
Types in `nuller` will only be considered null on null input, and will JSON encode to `null`. If you need zero and null be considered separate values, use these. Types in `nuller` will only be considered null on null input, and will JSON encode to `null`. If you need zero and null be considered separate values, use these.
All types implement `sql.Scanner`, so you can use this library in place of `sql.NullXXX`. All types implement `sql.Scanner` and `driver.Valuer`, so you can use this library in place of `sql.NullXXX`. All types also implement: `encoding.TextMarshaler`, `encoding.TextUnmarshaler`, `json.Marshaler`, and `json.Unmarshaler`.
### null.String ### null.String
A nullable string. Implements `sql.Scanner`, `encoding.Marshaler` and `encoding.TextUnmarshaler`, providing support for JSON and XML. A nullable string.
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. Can unmarshal from `sql.NullString` JSON input. 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. Can unmarshal from `sql.NullString` JSON input.

View file

@ -1,4 +1,4 @@
package null package nuller
import ( import (
"database/sql" "database/sql"

View file

@ -1,4 +1,4 @@
package null package nuller
import ( import (
"encoding/json" "encoding/json"

View file

@ -1,5 +1,6 @@
// Package null provides an opinionated yet reasonable way of handling null values. // Package nuller contains types that consider zero input and null input as separate values.
package null // Types in this package will always encode to their null value if null.
package nuller
import ( import (
"database/sql" "database/sql"

View file

@ -1,4 +1,4 @@
package null package nuller
import ( import (
"encoding/json" "encoding/json"

View file

@ -1,4 +1,6 @@
// Package null provides an opinionated yet reasonable way of handling null values. // Package null provides a convenient way of handling null values.
// Types in this package consider empty or zero input the same as null input.
// Types in this package will encode to their zero value, even if null.
package null package null
import ( import (