View Source Bonfire.Common.QueryModule behaviour (Bonfire v0.9.11-social-beta.6)

Properly query some data using the appropriate module depending on its schema. Back by a global cache of known query_modules to be queried by their schema, or vice versa.

Summary

Callbacks

Points to the related context module

Declares a query module

Points to the related schema module

Callbacks

context_module()

(optional)
@callback context_module() :: atom()

Points to the related context module

query_module()

(optional)
@callback query_module() :: any()

Declares a query module

schema_module()

(optional)
@callback schema_module() :: atom()

Points to the related schema module

Functions

app_modules()

apply_error(error, args)

linked_context_modules()

linked_schema_modules()

maybe_query(schema, filters \\ [], fallback_fun \\ &apply_error/2)

maybe_query_module(query)

modules()

@spec modules() :: [atom()]

Callback implementation for Bonfire.Common.ExtensionBehaviour.modules/0.

query_function_error(error, args, level \\ :info)

query_module(query)

Get a Queryable identified by name or id.

query_module!(query)

Look up a Queryable by name or id, throw :not_found if not found.

query_modules(modules)

@spec query_modules([binary() | atom()]) :: [binary()]

Look up many ids at once, throw :not_found if any of them are not found