optional

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 0 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 {
	Set   bool
	Null  bool
	Value T
}

Nullable represents patch semantics with explicit NULL support.

func Null

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

Null marks value as explicitly set to SQL NULL.

func SomeNullable

func SomeNullable[T any](v T) Nullable[T]

SomeNullable marks value as explicitly set to non-null payload.

func Unset

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

Unset marks value as absent.

func (Nullable[T]) IsNull

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

func (Nullable[T]) IsSet

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

func (Nullable[T]) ValueAny

func (n Nullable[T]) ValueAny() any

type Value

type Value[T any] struct {
	Set   bool
	Value T
}

Value represents explicit optional value semantics: set=true means field is present even when inner value is zero.

func None

func None[T any]() Value[T]

None marks value as absent.

func Some

func Some[T any](v T) Value[T]

Some marks value as explicitly set.

func (Value[T]) IsSet

func (o Value[T]) IsSet() bool

func (Value[T]) ValueAny

func (o Value[T]) ValueAny() any

Jump to

Keyboard shortcuts

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