Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Variant ¶
type Variant[X, Y any] struct { X X Y Y }
A Variant represents a single JSON map entry having two different Go type representations X and Y. After JSON unmarshalling you can check with HasX, HasY which field has been detected, while X is preferred. An example usage is a Client DTO response which can either be struct representing a secret hash, or a simple string response if that's a non-sensitive value.
func (Variant[X, Y]) MarshalJSON ¶
func (*Variant[X, Y]) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.