package
Version:
v0.1.11
Opens a new window with list of versions in this module.
Published: Jan 8, 2024
License: BSD-3-Clause
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
Package option provides optional (nullable) types.
type Option[T any] struct {
Valid bool `label:"Set"`
Value T `viewif:"Valid"`
}
Option represents an optional (nullable) type. If Valid is true, Option
represents Value. Otherwise, it represents a null/unset/invalid value.
Clear marks the value as null/unset/invalid.
func (o *Option[T]) Or(or T) T
Or returns the value of the option if it is not marked
as null/unset/invalid, and otherwise it returns the given value.
Set sets the value to the given value.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.