null

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Uint32

type Uint32 struct {
	Uint32 uint32
	Valid  bool
}

Uint32 encapsulates the value and validity (not null) of a uint32 value, to differentiate nil from 0 in json and sql.

func NewUint32

func NewUint32(i uint32, valid bool) Uint32

NewUint32 returns an instance of Uint32 with the passed parameters.

func Uint32From

func Uint32From(i uint32) Uint32

Uint32From creates a new Uint32 that will always be valid.

func (Uint32) MarshalJSON

func (i Uint32) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. It will encode null if this Uint32 is null.

func (Uint32) MarshalText

func (i Uint32) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Uint32 is null.

func (*Uint32) Scan

func (i *Uint32) Scan(value interface{}) error

Scan reads the database value and returns an instance.

func (*Uint32) SetValid

func (i *Uint32) SetValid(n uint32)

SetValid changes this Uint32's value and also sets it to be non-null.

func (*Uint32) UnmarshalJSON

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

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

func (*Uint32) UnmarshalText

func (i *Uint32) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Uint32 if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or "null".

func (Uint32) Value

func (i Uint32) Value() (driver.Value, error)

Value returns this instance serialized for database storage.

Jump to

Keyboard shortcuts

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