skuld_query
Auto-batching data fetches for Skuld: Haxl-style query do-notation with dependency analysis and concurrent dispatch.
What's included
Skuld.Query—query/defquerydo-notation macrosSkuld.QueryContract—deffetchfor batchable fetch contractsSkuld.Query.Contract— query contract protocol and wiringSkuld.Query.QueryBlock— dependency graph analysis and concurrent executionSkuld.Query.Cache— computation memoization
Installation
def deps do
[
{:skuld_query, "~> 0.32"}
]
end
Quick start
defmodule MyApp.Queries do
use Skuld.QueryContract
deffetch get_user(id :: String.t()) :: User.t() | nil
deffetch get_orders(user_id :: String.t()) :: [Order.t()]
end
use Skuld.Query
defquery user_with_orders(id) do
user <- MyApp.Queries.get_user(id)
orders <- MyApp.Queries.get_orders(id)
{user, orders}
end
See the architecture guide for how this fits into the Skuld ecosystem.