opt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ptr

func Ptr[T any](value T) *T

func ZeroPtr

func ZeroPtr[T comparable](value T) *T

Types

type ComparableText

type ComparableText interface {
	comparable
	Text
}

type Null

type Null[T any] struct {
	Value T
	Valid bool
}

func NewNull

func NewNull[T any](value T, valid bool) Null[T]

func NullFrom

func NullFrom[T any](value T) Null[T]

func NullFromPtr

func NullFromPtr[T any](value *T) Null[T]

func (Null[T]) Get

func (v Null[T]) Get() (value T, ok bool)

func (Null[T]) IsZero

func (v Null[T]) IsZero() bool

func (Null[T]) MarshalJSON

func (v Null[T]) MarshalJSON() ([]byte, error)

func (Null[T]) Or

func (v Null[T]) Or(value T) T

func (*Null[T]) Ptr

func (v *Null[T]) Ptr() *T

func (*Null[T]) Set

func (v *Null[T]) Set(value T)

func (Null[T]) Std

func (v Null[T]) Std() sql.Null[T]

func (*Null[T]) UnmarshalJSON

func (v *Null[T]) UnmarshalJSON(data []byte) error

type NullBool

type NullBool[T ~bool] struct {
	Value T
	Valid bool
}

func NewNullBool

func NewNullBool[T ~bool](value T, valid bool) NullBool[T]

func NullBoolFrom

func NullBoolFrom[T ~bool](value T) NullBool[T]

func NullBoolFromPtr

func NullBoolFromPtr[T ~bool](value *T) NullBool[T]

func (NullBool[T]) Get

func (v NullBool[T]) Get() (value T, ok bool)

func (NullBool[T]) IsZero

func (v NullBool[T]) IsZero() bool

func (NullBool[T]) MarshalJSON

func (v NullBool[T]) MarshalJSON() ([]byte, error)

func (NullBool[T]) MarshalText

func (v NullBool[T]) MarshalText() ([]byte, error)

func (NullBool[T]) Or

func (v NullBool[T]) Or(value T) T

func (*NullBool[T]) Ptr

func (v *NullBool[T]) Ptr() *T

func (*NullBool[T]) Set

func (v *NullBool[T]) Set(value T)

func (NullBool[T]) Std

func (v NullBool[T]) Std() sql.NullBool

func (*NullBool[T]) UnmarshalJSON

func (v *NullBool[T]) UnmarshalJSON(data []byte) error

func (*NullBool[T]) UnmarshalText

func (v *NullBool[T]) UnmarshalText(data []byte) error

type NullFloat

type NullFloat[T constraints.Float] struct {
	Value T
	Valid bool
}

func NewNullFloat

func NewNullFloat[T constraints.Float](value T, valid bool) NullFloat[T]

func NullFloatFrom

func NullFloatFrom[T constraints.Float](value T) NullFloat[T]

func NullFloatFromPtr

func NullFloatFromPtr[T constraints.Float](value *T) NullFloat[T]

func (NullFloat[T]) Get

func (v NullFloat[T]) Get() (value T, ok bool)

func (NullFloat[T]) IsZero

func (v NullFloat[T]) IsZero() bool

func (NullFloat[T]) MarshalJSON

func (v NullFloat[T]) MarshalJSON() ([]byte, error)

func (NullFloat[T]) MarshalText

func (v NullFloat[T]) MarshalText() ([]byte, error)

func (NullFloat[T]) Or

func (v NullFloat[T]) Or(value T) T

func (*NullFloat[T]) Ptr

func (v *NullFloat[T]) Ptr() *T

func (*NullFloat[T]) Set

func (v *NullFloat[T]) Set(value T)

func (NullFloat[T]) Std

func (v NullFloat[T]) Std() sql.NullFloat64

func (*NullFloat[T]) UnmarshalJSON

func (v *NullFloat[T]) UnmarshalJSON(data []byte) error

func (*NullFloat[T]) UnmarshalText

func (v *NullFloat[T]) UnmarshalText(data []byte) error

type NullInt

type NullInt[T constraints.Int] struct {
	Value T
	Valid bool
}

func NewNullInt

func NewNullInt[T constraints.Int](value T, valid bool) NullInt[T]

func NullIntFrom

func NullIntFrom[T constraints.Int](value T) NullInt[T]

func NullIntFromPtr

func NullIntFromPtr[T constraints.Int](value *T) NullInt[T]

func (NullInt[T]) Get

func (v NullInt[T]) Get() (value T, ok bool)

func (NullInt[T]) IsZero

func (v NullInt[T]) IsZero() bool

func (NullInt[T]) MarshalJSON

func (v NullInt[T]) MarshalJSON() ([]byte, error)

func (NullInt[T]) MarshalText

func (v NullInt[T]) MarshalText() ([]byte, error)

func (NullInt[T]) Or

func (v NullInt[T]) Or(value T) T

func (*NullInt[T]) Ptr

func (v *NullInt[T]) Ptr() *T

func (*NullInt[T]) Set

func (v *NullInt[T]) Set(value T)

func (NullInt[T]) Std

func (v NullInt[T]) Std() sql.NullInt64

func (NullInt[T]) Std16

func (v NullInt[T]) Std16() sql.NullInt16

func (NullInt[T]) Std32

func (v NullInt[T]) Std32() sql.NullInt32

func (NullInt[T]) Std64

func (v NullInt[T]) Std64() sql.NullInt64

func (*NullInt[T]) UnmarshalJSON

func (v *NullInt[T]) UnmarshalJSON(data []byte) error

func (*NullInt[T]) UnmarshalText

func (v *NullInt[T]) UnmarshalText(data []byte) error

type NullString

type NullString[T ~string] struct {
	Value T
	Valid bool
}

func NewNullString

func NewNullString[T ~string](value T, valid bool) NullString[T]

func NullStringFrom

func NullStringFrom[T ~string](value T) NullString[T]

func NullStringFromPtr

func NullStringFromPtr[T ~string](value *T) NullString[T]

func (NullString[T]) Get

func (v NullString[T]) Get() (value T, ok bool)

func (NullString[T]) IsZero

func (v NullString[T]) IsZero() bool

func (NullString[T]) MarshalJSON

func (v NullString[T]) MarshalJSON() ([]byte, error)

func (NullString[T]) MarshalText

func (v NullString[T]) MarshalText() ([]byte, error)

func (NullString[T]) Or

func (v NullString[T]) Or(value T) T

func (*NullString[T]) Ptr

func (v *NullString[T]) Ptr() *T

func (*NullString[T]) Set

func (v *NullString[T]) Set(value T)

func (NullString[T]) Std

func (v NullString[T]) Std() sql.NullString

func (*NullString[T]) UnmarshalJSON

func (v *NullString[T]) UnmarshalJSON(data []byte) error

func (*NullString[T]) UnmarshalText

func (v *NullString[T]) UnmarshalText(data []byte) error

type NullText

type NullText[T Text] struct {
	Null[T]
}

func NewNullText

func NewNullText[T Text](value T, valid bool) NullText[T]

func NullTextFrom

func NullTextFrom[T Text](value T) NullText[T]

func NullTextFromPtr

func NullTextFromPtr[T Text](value *T) NullText[T]

func (NullText[T]) MarshalText

func (v NullText[T]) MarshalText() ([]byte, error)

func (*NullText[T]) UnmarshalText

func (v *NullText[T]) UnmarshalText(data []byte) error

type NullTime

type NullTime struct {
	Value time.Time
	Valid bool
}

func NewNullTime

func NewNullTime(value time.Time, valid bool) NullTime

func NullTimeFrom

func NullTimeFrom(value time.Time) NullTime

func NullTimeFromPtr

func NullTimeFromPtr(value *time.Time) NullTime

func (NullTime) Get

func (v NullTime) Get() (value time.Time, ok bool)

func (NullTime) IsZero

func (v NullTime) IsZero() bool

func (NullTime) MarshalJSON

func (v NullTime) MarshalJSON() ([]byte, error)

func (NullTime) MarshalText

func (v NullTime) MarshalText() ([]byte, error)

func (NullTime) Or

func (v NullTime) Or(value time.Time) time.Time

func (*NullTime) Ptr

func (v *NullTime) Ptr() *time.Time

func (*NullTime) Set

func (v *NullTime) Set(value time.Time)

func (NullTime) Std

func (v NullTime) Std() sql.NullTime

func (*NullTime) UnmarshalJSON

func (v *NullTime) UnmarshalJSON(data []byte) error

func (*NullTime) UnmarshalText

func (v *NullTime) UnmarshalText(data []byte) error

type Text

type Zero

type Zero[T comparable] struct {
	Value T
	Valid bool
}

func NewZero

func NewZero[T comparable](value T, valid bool) Zero[T]

func ZeroFrom

func ZeroFrom[T comparable](value T) Zero[T]

func ZeroFromPtr

func ZeroFromPtr[T comparable](value *T) Zero[T]

func (Zero[T]) Get

func (v Zero[T]) Get() (value T, ok bool)

func (Zero[T]) IsZero

func (v Zero[T]) IsZero() bool

func (Zero[T]) MarshalJSON

func (v Zero[T]) MarshalJSON() ([]byte, error)

func (Zero[T]) Or

func (v Zero[T]) Or(value T) T

func (*Zero[T]) Ptr

func (v *Zero[T]) Ptr() *T

func (*Zero[T]) Set

func (v *Zero[T]) Set(value T)

func (Zero[T]) Std

func (v Zero[T]) Std() sql.Null[T]

func (*Zero[T]) UnmarshalJSON

func (v *Zero[T]) UnmarshalJSON(data []byte) error

type ZeroBool

type ZeroBool[T ~bool] struct {
	Value T
	Valid bool
}

func NewZeroBool

func NewZeroBool[T ~bool](value T, valid bool) ZeroBool[T]

func ZeroBoolFrom

func ZeroBoolFrom[T ~bool](value T) ZeroBool[T]

func ZeroBoolFromPtr

func ZeroBoolFromPtr[T ~bool](value *T) ZeroBool[T]

func (ZeroBool[T]) Get

func (v ZeroBool[T]) Get() (value T, ok bool)

func (ZeroBool[T]) IsZeroBool

func (v ZeroBool[T]) IsZeroBool() bool

func (ZeroBool[T]) MarshalJSON

func (v ZeroBool[T]) MarshalJSON() ([]byte, error)

func (ZeroBool[T]) MarshalText

func (v ZeroBool[T]) MarshalText() ([]byte, error)

func (ZeroBool[T]) Or

func (v ZeroBool[T]) Or(value T) T

func (*ZeroBool[T]) Ptr

func (v *ZeroBool[T]) Ptr() *T

func (*ZeroBool[T]) Set

func (v *ZeroBool[T]) Set(value T)

func (ZeroBool[T]) Std

func (v ZeroBool[T]) Std() sql.NullBool

func (*ZeroBool[T]) UnmarshalJSON

func (v *ZeroBool[T]) UnmarshalJSON(data []byte) error

func (*ZeroBool[T]) UnmarshalText

func (v *ZeroBool[T]) UnmarshalText(data []byte) error

type ZeroFloat

type ZeroFloat[T constraints.Float] struct {
	Value T
	Valid bool
}

func NewZeroFloat

func NewZeroFloat[T constraints.Float](value T, valid bool) ZeroFloat[T]

func ZeroFloatFrom

func ZeroFloatFrom[T constraints.Float](value T) ZeroFloat[T]

func ZeroFloatFromPtr

func ZeroFloatFromPtr[T constraints.Float](value *T) ZeroFloat[T]

func (ZeroFloat[T]) Get

func (v ZeroFloat[T]) Get() (value T, ok bool)

func (ZeroFloat[T]) IsZeroFloat

func (v ZeroFloat[T]) IsZeroFloat() bool

func (ZeroFloat[T]) MarshalJSON

func (v ZeroFloat[T]) MarshalJSON() ([]byte, error)

func (ZeroFloat[T]) MarshalText

func (v ZeroFloat[T]) MarshalText() ([]byte, error)

func (ZeroFloat[T]) Or

func (v ZeroFloat[T]) Or(value T) T

func (*ZeroFloat[T]) Ptr

func (v *ZeroFloat[T]) Ptr() *T

func (*ZeroFloat[T]) Set

func (v *ZeroFloat[T]) Set(value T)

func (ZeroFloat[T]) Std

func (v ZeroFloat[T]) Std() sql.NullFloat64

func (*ZeroFloat[T]) UnmarshalJSON

func (v *ZeroFloat[T]) UnmarshalJSON(data []byte) error

func (*ZeroFloat[T]) UnmarshalText

func (v *ZeroFloat[T]) UnmarshalText(data []byte) error

type ZeroInt

type ZeroInt[T constraints.Int] struct {
	Value T
	Valid bool
}

func NewZeroInt

func NewZeroInt[T constraints.Int](value T, valid bool) ZeroInt[T]

func ZeroIntFrom

func ZeroIntFrom[T constraints.Int](value T) ZeroInt[T]

func ZeroIntFromPtr

func ZeroIntFromPtr[T constraints.Int](value *T) ZeroInt[T]

func (ZeroInt[T]) Get

func (v ZeroInt[T]) Get() (value T, ok bool)

func (ZeroInt[T]) IsZeroInt

func (v ZeroInt[T]) IsZeroInt() bool

func (ZeroInt[T]) MarshalJSON

func (v ZeroInt[T]) MarshalJSON() ([]byte, error)

func (ZeroInt[T]) MarshalText

func (v ZeroInt[T]) MarshalText() ([]byte, error)

func (ZeroInt[T]) Or

func (v ZeroInt[T]) Or(value T) T

func (*ZeroInt[T]) Ptr

func (v *ZeroInt[T]) Ptr() *T

func (*ZeroInt[T]) Set

func (v *ZeroInt[T]) Set(value T)

func (ZeroInt[T]) Std

func (v ZeroInt[T]) Std() sql.NullInt64

func (ZeroInt[T]) Std16

func (v ZeroInt[T]) Std16() sql.NullInt16

func (ZeroInt[T]) Std32

func (v ZeroInt[T]) Std32() sql.NullInt32

func (ZeroInt[T]) Std64

func (v ZeroInt[T]) Std64() sql.NullInt64

func (*ZeroInt[T]) UnmarshalJSON

func (v *ZeroInt[T]) UnmarshalJSON(data []byte) error

func (*ZeroInt[T]) UnmarshalText

func (v *ZeroInt[T]) UnmarshalText(data []byte) error

type ZeroString

type ZeroString[T ~string] struct {
	Value T
	Valid bool
}

func NewZeroString

func NewZeroString[T ~string](value T, valid bool) ZeroString[T]

func ZeroStringFrom

func ZeroStringFrom[T ~string](value T) ZeroString[T]

func ZeroStringFromPtr

func ZeroStringFromPtr[T ~string](value *T) ZeroString[T]

func (ZeroString[T]) Get

func (v ZeroString[T]) Get() (value T, ok bool)

func (ZeroString[T]) IsZeroString

func (v ZeroString[T]) IsZeroString() bool

func (ZeroString[T]) MarshalJSON

func (v ZeroString[T]) MarshalJSON() ([]byte, error)

func (ZeroString[T]) MarshalText

func (v ZeroString[T]) MarshalText() ([]byte, error)

func (ZeroString[T]) Or

func (v ZeroString[T]) Or(value T) T

func (*ZeroString[T]) Ptr

func (v *ZeroString[T]) Ptr() *T

func (*ZeroString[T]) Set

func (v *ZeroString[T]) Set(value T)

func (ZeroString[T]) Std

func (v ZeroString[T]) Std() sql.NullString

func (*ZeroString[T]) UnmarshalJSON

func (v *ZeroString[T]) UnmarshalJSON(data []byte) error

func (*ZeroString[T]) UnmarshalText

func (v *ZeroString[T]) UnmarshalText(data []byte) error

type ZeroText

type ZeroText[T ComparableText] struct {
	Zero[T]
}

func NewZeroText

func NewZeroText[T ComparableText](value T, valid bool) ZeroText[T]

func ZeroTextFrom

func ZeroTextFrom[T ComparableText](value T) ZeroText[T]

func ZeroTextFromPtr

func ZeroTextFromPtr[T ComparableText](value *T) ZeroText[T]

func (ZeroText[T]) MarshalText

func (v ZeroText[T]) MarshalText() ([]byte, error)

func (*ZeroText[T]) UnmarshalText

func (v *ZeroText[T]) UnmarshalText(data []byte) error

type ZeroTime

type ZeroTime struct {
	Value time.Time
	Valid bool
}

func NewZeroTime

func NewZeroTime(value time.Time, valid bool) ZeroTime

func ZeroTimeFrom

func ZeroTimeFrom(value time.Time) ZeroTime

func ZeroTimeFromPtr

func ZeroTimeFromPtr(value *time.Time) ZeroTime

func (ZeroTime) Get

func (v ZeroTime) Get() (value time.Time, ok bool)

func (ZeroTime) IsZeroTime

func (v ZeroTime) IsZeroTime() bool

func (ZeroTime) MarshalJSON

func (v ZeroTime) MarshalJSON() ([]byte, error)

func (ZeroTime) MarshalText

func (v ZeroTime) MarshalText() ([]byte, error)

func (ZeroTime) Or

func (v ZeroTime) Or(value time.Time) time.Time

func (*ZeroTime) Ptr

func (v *ZeroTime) Ptr() *time.Time

func (*ZeroTime) Set

func (v *ZeroTime) Set(value time.Time)

func (ZeroTime) Std

func (v ZeroTime) Std() sql.NullTime

func (*ZeroTime) UnmarshalJSON

func (v *ZeroTime) UnmarshalJSON(data []byte) error

func (*ZeroTime) UnmarshalText

func (v *ZeroTime) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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