gogol icon indicating copy to clipboard operation
gogol copied to clipboard

firestore: `_vNullValue :: Maybe ValueNullValue` is Nothing for nulls

Open valyagolev opened this issue 2 years ago • 0 comments

In firestore's Value', _vNullValue :: Maybe ValueNullValue is Nothing if the field is null. For the fields that exist in the firestore database, the value from gogol looks like this:

Value' {_vGeoPointValue = Nothing, _vBytesValue = Nothing, _vIntegerValue = Nothing, _vTimestampValue = Nothing, _vDoubleValue = Nothing, _vStringValue = Nothing, _vBooleanValue = Nothing, _vMapValue = Nothing, _vArrayValue = Nothing, _vReferenceValue = Nothing, _vNullValue = Nothing}.

The meaning of all those fields of Value' is apparently "exclusively valued as...". First of all, perhaps a sum type would actually work better here than having a subfield for every variant of the type?

But even if this approach is kept, since data ValueNullValue = NullValue has a constructor, I think it'd be more semantically coherent to have _vNullValue = Just NullValue in case the firestore value is null.

valyagolev avatar Sep 01 '21 20:09 valyagolev