ash v1.29.0-rc1 Ash.DataLayer behaviour View Source
The interface for being an ash data layer.
This is a large behaviour, and this capability is not complete, but the idea
is to have a large amount of optional callbacks, and use the can?/2
callback
to ensure that the engine only ever tries to interact with the data layer in ways
that it supports.
Link to this section Summary
Link to this section Types
Specs
feature() :: :transact | :multitenant | {:lateral_join, Ash.resource()} | {:join, Ash.resource()} | {:aggregate, Ash.aggregate_kind()} | {:query_aggregate, Ash.aggregate_kind()} | :aggregate_filter | :aggregate_sort | :boolean_filter | :async_engine | :create | :read | :update | :destroy | :limit | :offset | :transact | :filter | {:filter_expr, struct()} | :sort | {:sort, Ash.Type.t()} | :upsert | :composite_primary_key
Link to this section Functions
Specs
add_aggregate(Ash.data_layer_query(), Ash.aggregate(), Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
can?(feature(), Ash.resource()) :: boolean()
Specs
create(Ash.resource(), Ash.changeset()) :: {:ok, Ash.record()} | {:error, term()}
Specs
destroy(Ash.resource(), Ash.changeset()) :: :ok | {:error, term()}
Specs
filter(Ash.data_layer_query(), Ash.filter(), Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
limit(Ash.data_layer_query(), limit :: non_neg_integer(), Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
offset(Ash.data_layer_query(), offset :: non_neg_integer(), Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
resource_to_query(Ash.resource(), Ash.api()) :: Ash.data_layer_query()
Specs
run_aggregate_query(Ash.data_layer_query(), [Ash.aggregate()], Ash.resource()) :: {:ok, map()} | {:error, term()}
Link to this function
run_aggregate_query_with_lateral_join(query, aggregates, root_data, source_resource, destination_resource, source, destination)
View SourceSpecs
run_query(Ash.data_layer_query(), central_resource :: Ash.resource()) :: {:ok, [Ash.record()]} | {:error, term()}
Link to this function
run_query_with_lateral_join(query, root_data, source_resource, destination_resource, source, destination)
View SourceSpecs
set_context(Ash.resource(), Ash.data_layer_query(), map()) :: Ash.data_layer_query()
Specs
set_tenant(Ash.resource(), Ash.data_layer_query(), term()) :: {:ok, Ash.data_layer_query()} | {:error, Ash.error()}
Specs
sort(Ash.data_layer_query(), Ash.sort(), Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
source(Ash.resource()) :: String.t()
Specs
update(Ash.resource(), Ash.changeset()) :: {:ok, Ash.record()} | {:error, term()}
Specs
upsert(Ash.resource(), Ash.changeset()) :: {:ok, Ash.record()} | {:error, term()}
Link to this section Callbacks
Specs
add_aggregate(Ash.data_layer_query(), Ash.aggregate(), Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
can?(Ash.resource(), feature()) :: boolean()
Specs
create(Ash.resource(), Ash.changeset()) :: {:ok, Ash.resource()} | {:error, term()}
Specs
destroy(Ash.resource(), Ash.changeset()) :: :ok | {:error, term()}
Specs
equal?(Ash.data_layer()) :: boolean()
Specs
filter(Ash.data_layer_query(), Ash.filter(), resource :: Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
functions(Ash.resource()) :: [module()]
Specs
in_transaction?(Ash.resource()) :: boolean()
Specs
limit( Ash.data_layer_query(), limit :: non_neg_integer(), resource :: Ash.resource() ) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
offset( Ash.data_layer_query(), offset :: non_neg_integer(), resource :: Ash.resource() ) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
operators(Ash.resource()) :: [module()]
Specs
resource_to_query(Ash.resource(), Ash.api()) :: Ash.data_layer_query()
Specs
rollback(Ash.resource(), term()) :: no_return()
Specs
run_aggregate_query(Ash.data_layer_query(), [Ash.aggregate()], Ash.resource()) :: {:ok, map()} | {:error, term()}
Link to this callback
run_aggregate_query_with_lateral_join(arg1, list, list, source_resource, destination_resource, source, destination)
View Source (optional)Specs
run_aggregate_query_with_lateral_join( Ash.data_layer_query(), [Ash.aggregate()], [Ash.record()], source_resource :: Ash.resource(), destination_resource :: Ash.resource(), source :: atom(), destination :: atom() ) :: {:ok, [Ash.resource()]} | {:error, term()}
Specs
run_query(Ash.data_layer_query(), Ash.resource()) :: {:ok, [Ash.resource()]} | {:error, term()}
Link to this callback
run_query_with_lateral_join(arg1, list, source_resource, destination_resource, source, destination)
View Source (optional)Specs
run_query_with_lateral_join( Ash.data_layer_query(), [Ash.record()], source_resource :: Ash.resource(), destination_resource :: Ash.resource(), source :: atom(), destination :: atom() ) :: {:ok, [Ash.resource()]} | {:error, term()}
Specs
set_context(Ash.resource(), Ash.data_layer_query(), map()) :: Ash.data_layer_query()
Specs
set_tenant(Ash.resource(), Ash.data_layer_query(), term()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
sort(Ash.data_layer_query(), Ash.sort(), resource :: Ash.resource()) :: {:ok, Ash.data_layer_query()} | {:error, term()}
Specs
source(Ash.resource()) :: String.t()
Specs
transaction(Ash.resource(), (() -> term())) :: {:ok, term()} | {:error, term()}
Specs
Specs
update(Ash.resource(), Ash.changeset()) :: {:ok, Ash.resource()} | {:error, term()}
Specs
upsert(Ash.resource(), Ash.changeset()) :: {:ok, Ash.resource()} | {:error, term()}