Documentation ¶
Index ¶
- type Float
- func (f Float) FullString() string
- func (f Float) IsZero() bool
- func (f Float) MarshalJSON() ([]byte, error)
- func (f Float) MarshalText() ([]byte, error)
- func (f Float) Ptr() *float64
- func (f *Float) SetValid(n float64)
- func (f Float) String() string
- func (f *Float) UnmarshalJSON(data []byte) error
- func (f *Float) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Float ¶
type Float struct {
sql.NullFloat64
}
Float is a nullable float64. It does not consider zero values to be null. It will decode to null, not zero, if null.
func FloatFromPtr ¶
FloatFromPtr creates a new Float that be null if f is nil.
func (Float) FullString ¶ added in v5.2.0
FullString returns float as string in full precision
func (Float) IsZero ¶
IsZero returns true for invalid Floats, for future omitempty support (Go 1.4?) A non-null Float with a 0 value will not be considered zero.
func (Float) MarshalJSON ¶
MarshalJSON implements json.Marshaler. It will encode null if this Float is null.
func (Float) MarshalText ¶
MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Float is null.
func (Float) Ptr ¶
Ptr returns a pointer to this Float's value, or a nil pointer if this Float is null.
func (Float) String ¶
MarshalText implements encoding.TextMarshaler. It will encode a blank string if this Float is null.
func (*Float) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler. It supports number and null input. 0 will not be considered a null Float. It also supports unmarshalling a sql.NullFloat64.
func (*Float) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler. It will unmarshal to a null Float if the input is a blank or not an integer. It will return an error if the input is not an integer, blank, or "null".