You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// MarshalText implements encoding.TextMarshaler.
// It will encode a blank string when this String is null.
func (s String) MarshalText() ([]byte, error) {
if !s.Valid {
return []byte{}, nil
}
return []byte(s.String), nil
}
// MarshalText implements encoding.TextMarshaler.
// It will encode a blank string if this Int is null.
func (i Int) MarshalText() ([]byte, error) {
if !i.Valid {
return []byte{}, nil
}
return []byte(strconv.FormatInt(i.Int64, 10)), nil
}
My question/curiosity is: why does null.Time text-marshaling return a "null" string instead of an empty string like the others?
The text was updated successfully, but these errors were encountered:
Testing my models on GraphQL, I detected some issues regarding text-marshaling implementation in this library.
null.Time returns "null"
Other null.X implementations
My question/curiosity is: why does null.Time text-marshaling return a "null" string instead of an empty string like the others?
The text was updated successfully, but these errors were encountered: