README.md

# erlquery

The erlquery parser and codegen core library. Meant to be used in tools like rebar plugins.

## Build

    rebar3 compile
        
## Test

    rebar3 eunit

## Usage

Include in deps:

    erlquery

erlquery can parse .erlq files into configs, and generate erlang modules based on these configs.

Make an erlq module like this:

    -module(example).

    -query(pgo:query/2).

    select_todos ->
        SELECT * FROM todos.

This file can be parsed into a config:

    {ok, Config} = erlquery:parse("example.erlq").

To generate the erlang module:

    {ok, Bin} = erlquery:codegen(Config),
    file:write_file("example.erl", Bin),
    {ok, example} = compile:file("example.erl").

Now the example module will be loaded into the Erlang environment and it can be used.

    example:select_todos([]).

The argument of a function generated by erlquery will always be a list. This is the args list.

# License

Apache 2.0