Documentation
¶
Overview ¶
Package types provides utility types and functions. Copyright (c) APIMatic. All rights reserved.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
Optional is a generic struct that allows any type to be used as optional and nullable. Optional.set is true when Optional.value is to be used.
func EmptyOptional ¶
EmptyOptional creates and returns an empty Optional instance with no value set.
func NewOptional ¶
NewOptional creates and returns an Optional instance with the given value set.
func (*Optional[T]) IsValueSet ¶
IsValueSet returns true if a value is set in the Optional, false otherwise.
func (Optional[T]) MarshalJSON ¶ added in v0.0.28
func (*Optional[T]) SetValue ¶
func (o *Optional[T]) SetValue(value *T)
SetValue sets the value of the Optional.
func (*Optional[T]) ShouldSetValue ¶
ShouldSetValue sets whether the value should be used or not.
func (*Optional[T]) UnmarshalJSON ¶
UnmarshalJSON unmarshal the JSON input into the Optional value.