Documentation
¶
Index ¶
- Variables
- func GetOpenAPISpecJSON() ([]byte, error)
- type ComplexOptionalNullable
- type ComplexRequiredNullable
- type Nullable
- func (n Nullable[T]) Get() (T, error)
- func (n Nullable[T]) IsNull() bool
- func (n Nullable[T]) IsSpecified() bool
- func (n Nullable[T]) MarshalJSON() ([]byte, error)
- func (n Nullable[T]) MustGet() T
- func (n *Nullable[T]) Set(value T)
- func (n *Nullable[T]) SetNull()
- func (n *Nullable[T]) SetUnspecified()
- func (n *Nullable[T]) UnmarshalJSON(data []byte) error
- type PatchRequest
- type SimpleOptionalNonNullable
- type SimpleOptionalNullable
- type SimpleRequiredNullable
Constants ¶
This section is empty.
Variables ¶
var ErrNullableIsNull = errors.New("nullable value is null")
ErrNullableIsNull is returned when trying to get a value from a null Nullable.
var ErrNullableNotSpecified = errors.New("nullable value is not specified")
ErrNullableNotSpecified is returned when trying to get a value from an unspecified Nullable.
Functions ¶
func GetOpenAPISpecJSON ¶
GetOpenAPISpecJSON returns the raw OpenAPI spec as JSON bytes.
Types ¶
type ComplexOptionalNullable ¶
type ComplexOptionalNullable struct {
// Optional and nullable
AliasName Nullable[string] `json:"alias_name,omitempty" form:"alias_name,omitempty"`
// Optional and non nullable
Name *string `json:"name,omitempty" form:"name,omitempty"`
}
#/components/schemas/complex_optional_nullable Complex, optional and nullable
func (*ComplexOptionalNullable) ApplyDefaults ¶
func (s *ComplexOptionalNullable) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type ComplexRequiredNullable ¶
type ComplexRequiredNullable struct {
// Optional and non nullable
Name *string `json:"name,omitempty" form:"name,omitempty"`
}
#/components/schemas/complex_required_nullable Complex required and nullable
func (*ComplexRequiredNullable) ApplyDefaults ¶
func (s *ComplexRequiredNullable) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type Nullable ¶
Nullable is a generic type that can distinguish between: - Field not provided (unspecified) - Field explicitly set to null - Field has a value
This is implemented as a map[bool]T where: - Empty map: unspecified - map[false]T: explicitly null - map[true]T: has a value
func NewNullNullable ¶
NewNullNullable creates a Nullable that is explicitly null.
func NewNullableWithValue ¶
NewNullableWithValue creates a Nullable with the given value.
func (Nullable[T]) IsSpecified ¶
IsSpecified returns true if the field was provided (either null or a value).
func (Nullable[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Nullable[T]) MustGet ¶
func (n Nullable[T]) MustGet() T
MustGet returns the value or panics if null or unspecified.
func (*Nullable[T]) SetNull ¶
func (n *Nullable[T]) SetNull()
SetNull marks the field as explicitly null.
func (*Nullable[T]) SetUnspecified ¶
func (n *Nullable[T]) SetUnspecified()
SetUnspecified clears the field (as if it was never set).
func (*Nullable[T]) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type PatchRequest ¶
type PatchRequest struct {
SimpleRequiredNullable SimpleRequiredNullable `json:"simple_required_nullable" form:"simple_required_nullable"`
SimpleOptionalNullable SimpleOptionalNullable `json:"simple_optional_nullable,omitempty" form:"simple_optional_nullable,omitempty"`
SimpleOptionalNonNullable *SimpleOptionalNonNullable `json:"simple_optional_non_nullable,omitempty" form:"simple_optional_non_nullable,omitempty"`
ComplexRequiredNullable Nullable[ComplexRequiredNullable] `json:"complex_required_nullable" form:"complex_required_nullable"`
ComplexOptionalNullable Nullable[ComplexOptionalNullable] `json:"complex_optional_nullable,omitempty" form:"complex_optional_nullable,omitempty"`
AdditionalProperties map[string]any `json:"-"`
}
#/components/schemas/PatchRequest A request to patch an existing user object.
func (*PatchRequest) ApplyDefaults ¶
func (s *PatchRequest) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
func (PatchRequest) MarshalJSON ¶
func (s PatchRequest) MarshalJSON() ([]byte, error)
func (*PatchRequest) UnmarshalJSON ¶
func (s *PatchRequest) UnmarshalJSON(data []byte) error
type SimpleOptionalNonNullable ¶
type SimpleOptionalNonNullable = string
#/components/schemas/simple_optional_non_nullable Simple optional and non nullable
type SimpleOptionalNullable ¶
#/components/schemas/simple_optional_nullable Simple optional and nullable
type SimpleRequiredNullable ¶
#/components/schemas/simple_required_nullable Simple required and nullable