void

package
v0.0.0-...-9c716d7 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Void

type Void[V any] struct {
	// contains filtered or unexported fields
}

Void is a generic wrapper type that can represent a value that may be explicitly undefined or unset, which is particularly useful for:

  • JSON marshaling/unmarshaling where fields can be omitted
  • Database operations where NULL values need to be distinguished from zero values

Supported types for V include:

  • Basic types
  • time.Time for timestamp handling
  • []byte for binary data
  • nil for explicit NULL values in databases

The zero value of Void[V] is considered undefined (valid = false).

func New

func New[V any](value V) Void[V]

func (Void[V]) Equal

func (v Void[V]) Equal(other Void[V]) bool

func (Void[V]) Get

func (v Void[V]) Get() V

func (Void[V]) IsVoid

func (v Void[V]) IsVoid() bool

func (Void[V]) MarshalJSON

func (v Void[V]) MarshalJSON() ([]byte, error)

Implement json.Marshaler

func (Void[V]) Ptr

func (v Void[V]) Ptr() *V

func (*Void[V]) Scan

func (v *Void[V]) Scan(src any) error

Implement sql.Scanner

func (*Void[V]) Set

func (v *Void[V]) Set(value V)

func (*Void[V]) UnmarshalJSON

func (v *Void[V]) UnmarshalJSON(data []byte) error

Implement json.Unmarshaler

func (*Void[V]) UnmarshalText

func (v *Void[V]) UnmarshalText(text []byte) error

Implement encoding.TextUnmarshaler

func (*Void[V]) Unset

func (v *Void[V]) Unset()

func (Void[V]) Value

func (v Void[V]) Value() (driver.Value, error)

Implement driver.Valuer

Jump to

Keyboard shortcuts

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