This repository is moving into maintenance mode. Please use the new Postgrest-ex library. We will archive the hex.pm library as well. Thank you for your usage over the past few years.
Status: POC
Elixir Postgrestex library for Postgrest. The design mirrors that of postgrest-py
If available in Hex, the package can be installed
by adding postgrestex
to your list of dependencies in mix.exs
:
def deps do
[
{:postgrestex, "~> 0.1.2"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/postgrestex.
First, import Postgrestex
Then do any one of the following options:
Example usage:
init("public") \
|> from("users") \
|> insert(
%{username: "nevergonna", age_range: "[1,2)", status: "ONLINE", catchphrase: "giveyouup"},
false
) \
|> call()
Example usage:
init("public") \
|> from("messages") \
|> select(["id", "username"]) \
|> call()
Example usage:
init("public") \
|> from("users") \
|> eq("username", "supabot") \
|> update(%{status: "OFFLINE"}) \
|> call()
Example usage:
init("public") \
|> from("users") \
|> eq("username", "nevergonna") \
|> eq("status", "ONLINE") \
|> delete() \
|> call()
Run mix test