null

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int64

type Int64 struct {
	Int64 int64
	Valid bool
}

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

func Int64From

func Int64From(i int64) Int64

Int64From creates a new Int64 that will always be valid.

func NewInt64

func NewInt64(i int64, valid bool) Int64

NewInt64 returns an instance of Int64 with the passed parameters.

func (Int64) MarshalJSON

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

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

func (Int64) MarshalText

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

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

func (*Int64) Scan

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

Scan reads the database value and returns an instance.

func (*Int64) SetValid

func (i *Int64) SetValid(n int64)

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

func (*Int64) UnmarshalJSON

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

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

func (*Int64) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Int64 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 (Int64) Value

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

Value returns this instance serialized for database storage.

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