View Source Bonfire.Common.ContextModule behaviour (bonfire_umbrella v0.3.6-classic-beta.7)

Find a context or query module via its schema, backed by a global cache of known modules.

Link to this section Summary

Callbacks

Declares a context module

Points to the related queries module

Points to the related schema module

Functions

Look up a context, throw :not_found if not found.

Get a context identified by schema

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

Given an object or schema module name, run a function on the associated context module.

Link to this section Callbacks

@callback context_module() :: any()

Declares a context module

@callback queries_module() :: atom()

Points to the related queries module

@callback schema_module() :: atom()

Points to the related schema module

Link to this section Functions

Link to this function

apply_error(error, args)

View Source
Link to this function

context_function_error(error, args)

View Source

Look up a context, throw :not_found if not found.

Get a context identified by schema

Link to this function

context_modules(modules)

View Source
@spec context_modules([binary() | atom()]) :: [binary()]

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

Link to this function

maybe_apply(object_schema_or_context, fun, args \\ [], fallback_fun \\ &apply_error/2)

View Source

Given an object or schema module name, run a function on the associated context module.

Link to this function

maybe_context_module(query)

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

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