Skip to content

Instantly share code, notes, and snippets.

@JunKikuchi
Last active January 29, 2019 16:17
Show Gist options
  • Save JunKikuchi/138708d16b0c95a4ce88c64022064d2f to your computer and use it in GitHub Desktop.
Save JunKikuchi/138708d16b0c95a4ce88c64022064d2f to your computer and use it in GitHub Desktop.
import Control.Lens
import Data.ProtoLens.Runtime.Data.ProtoLens
import Proto.Google.Firestore.V1beta1.Document as Doc
import Proto.Google.Firestore.V1beta1.Document_Fields as Doc
import Data.Text as T
import Data.Map
value = defMessage & maybe'valueType .~ (_Just # _Value'BooleanValue # Prelude.True) :: Doc.Value
-- {boolean_value: true}
doc = defMessage & Doc.fields .~ (fromList [(T.pack "foo", value)]) :: Doc.Document
-- {fields { key: "foo" value { boolean_value: true } }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment