This module defines the watts_persistent behaviour.
Required callback functions: initialize/0, credential_add/5, credential_get_list/1, credential_get_count/2, credential_get/1, credential_remove/2, is_ready/0.
credential_delete/2 | delete the credential with the Id. |
credential_fetch/2 | get the credential with the Id for the given User. |
credential_fetch_list/1 | fetch the list of all credentials for a user. |
credential_service_count/2 | get the number of credentials of the user at the service. |
credential_store/5 | storing a credential, this is done by calling the configured database and credential_add there. |
ensure_credential_of_user/2* | this function ensures that credentials are only returned to their owner. |
init/0 | this gets called during initialization. |
is_ready/0 | check if the configured database is ready. |
mod/0* | get the configured database module. |
credential_delete(UserId::binary(), CredentialId::binary()) -> ok | {error, Reason::atom()}
delete the credential with the Id. using the configured database.
credential_fetch(CredId::binary(), UserId::binary()) -> {ok, watts:credential()} | {error, Reason::atom()}
get the credential with the Id for the given User. using the configured database.
credential_fetch_list(UserId::binary()) -> {ok, [watts:credential()]}
fetch the list of all credentials for a user. using the configured database.
credential_service_count(UserId::binary(), ServiceId::binary()) -> {ok, pos_integer()}
get the number of credentials of the user at the service. using the configured database.
credential_store(UserId::binary(), ServiceId::binary(), Interface::binary(), CredState::any(), AllowNonUniqueStates::boolean()) -> {ok, CredentialId::binary()} | {error, Reason::atom()}
storing a credential, this is done by calling the configured database and credential_add there.
ensure_credential_of_user(Result::{ok, watts:credential()} | {error, Reason::atom()}, UserId::binary()) -> {ok, watts:credential()} | {error, Reason::atom()}
this function ensures that credentials are only returned to their owner.
init() -> ok | {error, Reason::atom()}
this gets called during initialization. The function calls the initalize function of the configured database.
is_ready() -> true | {false, Reason::any()}
check if the configured database is ready.
mod() -> atom()
get the configured database module.
Generated by EDoc