null

package
v1.5.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool

type Bool struct {
	sql.NullBool
}

Bool is a nullable bool. It does not consider false values to be null. It will decode to null, not false, if null.

func (Bool) IsZero

func (b Bool) IsZero() bool

IsZero returns true for invalid Bools, for future omitempty support (Go 1.4?). A non-null Bool with a 0 value will not be considered zero.

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Bool. It also supports unmarshalling a sql.NullBool.

type Int

type Int struct {
	sql.NullInt64
}

Int is an nullable int64. It does not consider zero values to be null. It will decode to null, not zero, if null.

func (Int) IsZero

func (i Int) IsZero() bool

IsZero returns true for invalid Ints, for future omitempty support (Go 1.4?). A non-null Int with a 0 value will not be considered zero.

func (*Int) UnmarshalJSON

func (i *Int) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Int. It also supports unmarshalling a sql.NullInt64.

type String

type String struct {
	sql.NullString
}

String is a nullable string. It supports SQL and JSON serialization. It will marshal to null if null. Blank string input will be considered null.

func (String) IsZero

func (s String) IsZero() bool

IsZero returns true for null strings, for potential future omitempty support.

func (*String) UnmarshalJSON

func (s *String) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. It supports string and null input. Blank string input does not produce a null String. It also supports unmarshalling a sql.NullString.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL