Skip to content

danilobuerger/null

Repository files navigation

Build Status Coverage Status Go Report Card

null

Types

Nullable types for Go. All types implement:

  • sql.Scanner
  • driver.Valuer
  • json.Marshaler
  • json.Unmarshaler
  • encoding.TextMarshaler
  • encoding.TextUnmarshaler
  • xml.Marshaler
  • xml.Unmarshaler

When marshaling xml, the attribute xsi:nil="true" will be added for null values. When unmarshaling xml, the value will be null if xsi:nil="true" is set.

Float64

null.Float64 is based on sql.NullFloat64 and exports the fields Float64 and Valid. Valid is true if Float64 is not null.

Int64

null.Int64 is based on sql.NullInt64 and exports the fields Int64 and Valid. Valid is true if Int64 is not null.

String

null.String is based on sql.NullString and exports the fields String and Valid. Valid is true if String is not null.

When using encoding.TextUnmarshaler, an empty text will be valid.