Native Elixir engine: parse, render, booking-aware check, and canned reports.
Full parity with the CLI oracle is asserted on the golden fixtures via
Beancount.Compare.compare/3.
Summary
Functions
Parse and validate .bean text with the native booking engine.
Read and validate a .bean file from disk.
Parse the ledger and run a canned report query.
Render directives to .bean text via Beancount.Renderer.
Functions
Parse and validate .bean text with the native booking engine.
Examples
iex> text = """
...> 2026-01-01 open Assets:Bank USD
...> 2026-01-01 open Income:Salary USD
...> 2026-01-01 open Equity:Opening USD
...>
...> 2026-01-31 * "Employer" "Salary"
...> Assets:Bank 100 USD
...> Income:Salary -100 USD
...> """
iex> {:ok, %Beancount.Result{status: :ok}} = Beancount.Engine.Elixir.check(text)
Read and validate a .bean file from disk.
Examples
path = Path.join(System.tmp_dir!(), "elixir_check.bean")
File.write!(path, """
2026-01-01 open Assets:Bank USD
2026-01-01 open Income:Salary USD
2026-01-01 open Equity:Opening USD
2026-01-31 * "Employer" "Salary"
Assets:Bank 100 USD
Income:Salary -100 USD
""")
{:ok, %Beancount.Result{status: :ok}} = Beancount.Engine.Elixir.check_file(path)
Parse the ledger and run a canned report query.
Examples
iex> text = """
...> 2026-01-01 open Assets:Bank USD
...> 2026-01-01 open Income:Salary USD
...> 2026-01-01 open Equity:Opening USD
...>
...> 2026-01-31 * "Employer" "Salary"
...> Assets:Bank 100 USD
...> Income:Salary -100 USD
...> """
iex> {:ok, %Beancount.Query.Result{columns: cols}} =
...> Beancount.Engine.Elixir.query(text, "SELECT account, sum(position) AS balance GROUP BY account ORDER BY account")
iex> cols
["account", "balance"]
Render directives to .bean text via Beancount.Renderer.
Examples
iex> Beancount.Engine.Elixir.render([Beancount.open(~D[2026-01-01], "Assets:Bank", ["USD"])])
"2026-01-01 open Assets:Bank USD\n"