null

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PtrFromNullInt64

func PtrFromNullInt64(num NullInt64) *int64

PtrFromNullInt64 converts a NullInt64 to a *int64. If the NullInt64 is not Valid nil is returned.

func PtrFromNullString

func PtrFromNullString(str NullString) *string

PtrFromNullString converts a NullString to a *string. If the NullString is not Valid nil is returned.

Types

type NullInt64

type NullInt64 struct {
	sql.NullInt64      // allows use with sql/database and grants null support (null if Valid = false)
	Dirty         bool // tracks if the argument has been provided at all (provided if Dirty = true)
}

NullInt64 is an int64 that can be NULL.

func NullInt64From

func NullInt64From(num int64) NullInt64

NullInt64From converts an int to a NullInt. If the int is zero it will be treated as null. The returned NullInt64 will have Dirty set to true.

func NullInt64FromPtr

func NullInt64FromPtr(num *int64) NullInt64

NullInt64FromPtr converts a *int64 to a NullInt64. If the int64 is nil it will be treated as null. The returned NullInt64 will have Dirty set to true.

func (NullInt64) MarshalJSON

func (s NullInt64) MarshalJSON() ([]byte, error)

MarshalJSON marshalls a NullInt64 to JSON.

func (*NullInt64) UnmarshalJSON

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

UnmarshalJSON unmarshalls a NullInt64 from JSON.

type NullString

type NullString struct {
	sql.NullString      // allows use with sql/database and grants null support (null if Valid = false)
	Dirty          bool // tracks if the argument has been provided at all (provided if Dirty = true)
}

NullString is a string that can be NULL.

func NullStringFrom

func NullStringFrom(str string) NullString

NullStringFrom converts a string to a NullString. The returned NullString will have Dirty set to true.

func NullStringFromPtr

func NullStringFromPtr(str *string) NullString

NullStringFromPtr converts a *string to a NullString. If the string is nil it will be treated as null. The returned NullString will have Dirty set to true.

func (NullString) MarshalJSON

func (s NullString) MarshalJSON() ([]byte, error)

MarshalJSON marshalls a NullString to JSON.

func (*NullString) UnmarshalJSON

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

UnmarshalJSON unmarshalls a NullString from JSON.

Jump to

Keyboard shortcuts

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