nullable

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Nullable

type Nullable[T any] struct {
	Data  T
	Valid bool
}

Nullable represents data that also can be NULL

func Null added in v0.1.1

func Null[T any]() Nullable[T]

Null Create a Nullable that is NULL with type

func Value

func Value[T any](value T) Nullable[T]

Value Create a Nullable from a value

func ValueFromPointer added in v0.1.2

func ValueFromPointer[T any](value *T) Nullable[T]

ValueFromPointer Create a Nullable from a pointer

func (Nullable[T]) Equal

func (n Nullable[T]) Equal(other Nullable[T]) bool

Equal Check if this Nullable is equal to another Nullable

func (Nullable[T]) ExactEqual

func (n Nullable[T]) ExactEqual(other Nullable[T]) bool

ExactEqual Check if this Nullable is exact equal to another Nullable, never using intern Equal method to check equality

func (Nullable[T]) GoString added in v0.1.3

func (n Nullable[T]) GoString() string

func (Nullable[T]) IsZero added in v0.1.3

func (n Nullable[T]) IsZero() bool

func (Nullable[T]) MarshalJSON

func (n Nullable[T]) MarshalJSON() ([]byte, error)

func (Nullable[T]) MarshalText

func (n Nullable[T]) MarshalText() ([]byte, error)

func (*Nullable[T]) Scan added in v0.1.2

func (n *Nullable[T]) Scan(value any) error

func (Nullable[T]) String

func (n Nullable[T]) String() string

String Convert value to string

func (*Nullable[T]) UnmarshalJSON

func (n *Nullable[T]) UnmarshalJSON(data []byte) error

func (*Nullable[T]) UnmarshalText

func (n *Nullable[T]) UnmarshalText(text []byte) error

func (Nullable[T]) Value

func (n Nullable[T]) Value() (driver.Value, error)

func (Nullable[T]) ValueOrZero

func (n Nullable[T]) ValueOrZero() T

ValueOrZero Get Value, or default zero value if it is NULL

Jump to

Keyboard shortcuts

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