Postgrestex (Postgrestex v0.1.2) View Source

Postgrestex is a client library which provides elixir bindings to interact with PostgREST. PostgREST in turn is a standalone web server that turns your PostgreSQL database directly into a RESTful API.

Link to this section Summary

Functions

Authenticate the client with either the bearer token or basic authentication.

Take in and execute a request. Doesn't return an exception if an error is thrown.

Take in and execute a request. Raises an exception if an error occurs.

Delete an existing value in the currently selected table.

Either filter in or filter out based on negate_next.

Select table to obtain data from/perform operations on

Creates an initial request in the form of a map that the user can work with.

Insert a row into currently selected table. Does an insert and update if upsert is set to True

Toggle between filtering in or filtering out.

Execute a Stored Procedure Call

Remove reserved characters from the parameter string.

Switch to another schema.

Update an existing value in the currently selected table.

Link to this section Functions

Specs

adj(map(), String.t(), integer()) :: map()
Link to this function

auth(req, token, username \\ "", password \\ "")

View Source

Specs

auth(map(), String.t(), String.t(), String.t()) :: map()

Authenticate the client with either the bearer token or basic authentication.

Specs

Take in and execute a request. Doesn't return an exception if an error is thrown.

Link to this function

call!(req)

View Source (since 0.1.0)

Specs

call!(map()) ::
  {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()}
  | Postgrestex.NoMethodException

Take in and execute a request. Raises an exception if an error occurs.

Link to this function

delete(req, options \\ [])

View Source (since 0.1.0)

Specs

delete(map(), keyword()) :: map()

Delete an existing value in the currently selected table.

Specs

eq(map(), String.t(), String.t()) :: map()
Link to this function

filter(req, column, operator, criteria)

View Source (since 0.1.0)

Specs

filter(map(), String.t(), String.t(), String.t()) :: map()

Either filter in or filter out based on negate_next.

Specs

from(map(), String.t()) :: map()

Select table to obtain data from/perform operations on

Specs

fts(map(), String.t(), String.t()) :: map()

Specs

gt(map(), String.t(), String.t()) :: map()

Specs

gte(map(), String.t(), String.t()) :: map()
Link to this function

ilike(req, column, pattern)

View Source

Specs

ilike(map(), String.t(), String.t()) :: map()
Link to this function

in_(req, column, values)

View Source
Link to this function

init(schema, path \\ "http://localhost:3000")

View Source (since 0.1.0)

Specs

init(map(), String.t()) :: map()

Creates an initial request in the form of a map that the user can work with.

Link to this function

insert(req, json, options)

View Source (since 0.1.0)

Insert a row into currently selected table. Does an insert and update if upsert is set to True

Link to this function

insert(req, json, upsert \\ false, options \\ [])

View Source

Specs

insert(map(), map(), true | false, keyword()) :: map()

Specs

is_(map(), String.t(), String.t()) :: map()
Link to this function

like(req, column, pattern)

View Source

Specs

like(map(), String.t(), String.t()) :: map()

Specs

limit(map(), integer(), integer()) :: map()

Specs

lt(map(), String.t(), String.t()) :: map()

Specs

lte(map(), String.t(), String.t()) :: map()

Specs

neq(map(), String.t(), String.t()) :: map()

Specs

not map() :: map()

Toggle between filtering in or filtering out.

Specs

nxl(map(), String.t(), integer()) :: map()

Specs

nxr(map(), String.t(), integer()) :: map()
Link to this function

order(req, column, desc \\ false, nullsfirst \\ false)

View Source

Specs

order(map(), String.t(), true | false, true | false) :: map()
Link to this function

phfts(req, column, query)

View Source

Specs

phfts(map(), String.t(), String.t()) :: map()
Link to this function

plfts(req, column, query)

View Source

Specs

plfts(map(), String.t(), String.t()) :: map()

Specs

range(map(), integer(), integer()) :: map()
Link to this function

rpc(req, func, params)

View Source (since 0.1.0)

Specs

rpc(map(), String.t(), map()) :: map()

Execute a Stored Procedure Call

Link to this function

sanitize_params(str)

View Source (since 0.1.0)

Specs

sanitize_params(String.t()) :: String.t()

Remove reserved characters from the parameter string.

Link to this function

sanitize_pattern_params(str)

View Source

Specs

sanitize_pattern_params(String.t()) :: String.t()

Specs

schema(map(), String.t()) :: map()

Switch to another schema.

Specs

select(map(), list()) :: map()

Specs

single(map()) :: map()

Specs

sl(map(), String.t(), integer()) :: map()

Specs

sr(map(), String.t(), integer()) :: map()
Link to this function

update(req, json)

View Source (since 0.1.0)

Specs

update(map(), map()) :: map()

Update an existing value in the currently selected table.

Link to this function

update_headers(req, updates)

View Source

Specs

update_headers(map(), map()) :: map()
Link to this function

wfts(req, column, query)

View Source

Specs

wfts(map(), String.t(), String.t()) :: map()