Skip to content

About

SQL compiler for Erlang

Resources

Stars

1 star

Watchers

2 watching

Forks

Latest commit

 

History

35 Commits

Folders and files

Repository files navigation

sqlc

SQL compiler for Erlang

Build

$ rebar3 compile

Example

{ok, Module} = sqlc:string(example, "
    query by_id(:id uuid) as
        select user_id as id, name, avatar_url, created_at
            from example.user
            where user_id = :id;
"),
io:format("~ts", [sqlc:to_erl(Module)]).

prints the generated module:

-module(example).

-moduledoc(false).

-export([by_id/1]).

by_id(#{id := Id}) ->
    #{name => {example, by_id}, type => query,
      statement =>
          [<<"select user_id as id, name, avatar_url, created_at\n "
             "   from example.user\n    where user_id = "/utf8>>,
           {parameter, #{key => {example, by_id, id}, value => Id, type => <<"uuid">>}}]}.

About

SQL compiler for Erlang

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages