u/taure1

▲ 17 r/erlang

I wanted Ecto's ergonomics in Erlang without writing Elixir, so I wrote Kura. It sits on pgo. You define a schema, build queries, get changesets, run migrations.

-module(user).
-behaviour(kura_schema).
-include_lib("kura/include/kura.hrl").
-export([table/0, fields/0]).
table() -> ~"users".
fields() ->
[#kura_field{name = id, type = id, primary_key = true},
#kura_field{name = email, type = string, nullable = false},
#kura_field{name = name, type = string},
#kura_field{name = inserted_at, type = utc_datetime}].

Querying:

Q = kura_query:from(user),
Q1 = kura_query:where(Q, fun(U) -> U#user.age > 18 end),
my_repo:all(kura_query:order_by(Q1, [{desc, inserted_at}])).

It does the things you'd expect: schemas, changesets, composable queries with joins/CTEs/subqueries/window functions, migrations, associations with preloading, embedded JSONB, transaction pipelines, multitenancy via schema prefix, optimistic locking, audit trail, cursor streaming, pagination.

It's not a port. Records and functions, no macro DSL. The README has a coming-from-Ecto cheatsheet.

https://github.com/Taure/kura

u/taure1 — 5 days ago