Safe Haskell | None |
---|---|
Language | Haskell2010 |
This is an arguably convenient wrapper around gogol's FireStore
. This is likely not the idiomatic or best API for Google Firestore/Datastore/Firebase. I don't even understand the difference between all of those trademarks. Bug reports and suggestions are welcome.
Synopsis
- data Document = Document {}
- data Value
- data FireStore a
- runFireStore :: (MonadUnliftIO m, HasEnv s env, AllowScopes s, HasScope' s FireStoreScope ~ 'True) => env -> Text -> FireStore a -> m a
- defaultEnvironment :: IO (Env FireStoreScope)
- listAllDocuments :: Text -> FireStore [Document]
- patchDocument :: Text -> Document -> FireStore Document
- module Database.Firestore.Types
The types
Instances
Eq Document Source # | |
Show Document Source # | |
Generic Document Source # | |
ToJSON Document Source # | |
Defined in Database.Firestore.Types | |
type Rep Document Source # | |
Defined in Database.Firestore.Types type Rep Document = D1 ('MetaData "Document" "Database.Firestore.Types" "firestore-0.1.0.0-GrbsSLYeGb4AmfYCFA8tEe" 'False) (C1 ('MetaCons "Document" 'PrefixI 'True) ((S1 ('MetaSel ('Just "name") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "createTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime))) :*: (S1 ('MetaSel ('Just "updateTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe UTCTime)) :*: S1 ('MetaSel ('Just "fields") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap Text Value))))) |
GeoPoint Double Double | |
Bytes ByteString | |
Int Integer | |
Timestamp UTCTime | |
Double Double | |
String Text | |
Bool Bool | |
Map (HashMap Text Value) | |
Array [Value] | |
Reference Text | |
Null |
Instances
This is just a convenience monad that allows one to avoid all the gogol machinery.
Running FireStore
runFireStore :: (MonadUnliftIO m, HasEnv s env, AllowScopes s, HasScope' s FireStoreScope ~ 'True) => env -> Text -> FireStore a -> m a Source #
Runs the FireStore monad. It needs the env and the project name.
runFireStore env "myproject" someFireStoreAction
defaultEnvironment :: IO (Env FireStoreScope) Source #
This initializes the the google environment with stderr logging, tls manager, and "application default" credentials. (gcloud auth login
on your local machine, or maybe gcloud auth application-default login
, and it will also probably "just work" with the relevant service account (e.g. "compute") in the cloud). It will only have the scopes needed for FireStore (FireStoreScope
).
This is just pure convenience.
do env <- defaultEnvironment result <- runFireStore env "myproject" someFireStoreAction
CRUD
listAllDocuments :: Text -> FireStore [Document] Source #
It only wants the collection name itself. In the language of the Google's resource identifiers,
this will get into ("projects/" <> projectName <> "/databases/(default)/documents/" <> collectionName)
.
Apparently, (default)
is the actual real name of the only database you can have.
Other stuff
You can check out the docs for the additional types, as well as the lenses in the Types
module:
module Database.Firestore.Types