View Source Backpex.Adapter behaviour (Backpex v0.9.1)

Specification of the datalayer adapter.

Work in progress

The Backpex.Adapter behaviour is currently under heavy development and will change drastically in future updates. Backpex started out as Ecto-only and this is still deeply embedded in the core. We are working on changing this. Do not rely on the current API to build new adapters, as the callbacks will still change significantly. This will be an iterative process over the next few releases.

Summary

Callbacks

Applies a change to a given item.

Gets the total count of the current live_resource. Possibly being constrained the item query and the search- and filter options.

Deletes multiple items.

Gets a database record with the given primary key value.

Gets a database record with the given primary key value.

Inserts given item.

Returns a list of items by given criteria.

Updates given item.

Updates given items.

Callbacks

change(term, term, term, term, term, term)

@callback change(term(), term(), term(), term(), term(), term()) :: term()

Applies a change to a given item.

count(term, term, term, term)

@callback count(term(), term(), term(), term()) :: term()

Gets the total count of the current live_resource. Possibly being constrained the item query and the search- and filter options.

delete_all(list, term)

@callback delete_all(list(), term()) :: {:ok, term()} | {:error, term()}

Deletes multiple items.

get(term, term, term)

@callback get(term(), term(), term()) :: term()

Gets a database record with the given primary key value.

Should return nil if no result was found.

get!(term, term, term)

@callback get!(term(), term(), term()) :: term()

Gets a database record with the given primary key value.

Should raise an exception if no result was found.

insert(term, term)

@callback insert(term(), term()) :: term()

Inserts given item.

list(term, term, term, term)

@callback list(term(), term(), term(), term()) :: term()

Returns a list of items by given criteria.

update(term, term)

@callback update(term(), term()) :: term()

Updates given item.

update_all(term, term, term)

@callback update_all(term(), term(), term()) :: term()

Updates given items.