PPlusFireStore (pplus_firestore v0.1.5)
View SourceDocumentation for PPlusFireStore
.
This module is responsible for initializing the service that will manage access tokens to Google Firestore with the access credentials configured for your Firestore repository module.
By default, the service responsible for fetching the access token is Goth, but you can configure another access token fetching service through the :token_fetcher
key in your repository configuration.
Goth uses the configured access credentials to fetch the access token and cache it. When requested, the service retrieves the access token from the cache and checks if it is still valid. If the access token is not in the cache or has expired, the service will fetch a new access token.
Usage
Define a repository module that implements the PPlusFireStore.Repo interface.
defmodule MyFireStoreRepo do
use PPlusFireStore.Repo, otp_app: :my_app
end
Configure the repository module with Google Firestore credentials and add it to your supervision tree.
defmodule MyApp.Application do
use Application
@impl true
def start(_type, _args) do
children = [
{PPlusFireStore, [MyFireStoreRepo]}
]
opts = [strategy: :one_for_one, name: MyApp.Supervisor]
Supervisor.start_link(children, opts)
end
end
You can have more than one configured repository module, just add more repository modules to the list of modules.
children = [
{PPlusFireStore, [MyFireStoreRepo, MyOtherFireStoreRepo]}
]
Summary
Functions
Returns a specification to start this module under a supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.