Documentation ¶
Overview ¶
package tribool implements a simple nullable three-valued construct. It can be safely serialized/deserialized by JSON libraries.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tribool ¶
Tribool is a nullable three-value construct.
func New ¶
New creates a Tribool out of an integer. Positive integer creates 'yes' value, 0 creates 'maybe' values, negative integer generates 'no value. If no number is given, the result represents null, if more than one number is given, other numbers are ignored.
func (Tribool) Int ¶
Returns integer representation of Tribool. For "yes" it returns 1, for "no" and "null" it returns -1, and for "maybe it returns 0.
func (Tribool) MarshalJSON ¶
MarshalJSON implements json.Marshaler. It will encode null if this Int is null.
func (*Tribool) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaller.