john-kelly/elm-postgrest

PostgREST Query Builder


Install
elm-package install john-kelly/elm-postgrest 4.1.0

Documentation

elm-postgrest

Build Status

A query builder library for PostgREST.

Example

import PostgRest as PG

type PokemonResource
    = PokemonResource

pokemonResource =
    PG.resource PokemonResource
        "pokemon"
        { id = PG.int "id"
        , name = PG.string "name"
        , base_experience = PG.int "base_experience"
        , weight = PG.int "weight"
        , height = PG.int "height"
        }

type alias Pokemon =
    { id : Int
    , name : String
    }

pokemonRequest =
    PG.query pokemonResource Pokemon
        |> PG.select .id
        |> PG.select .name
        |> PG.filter [ .id |> PG.lte 151 ]
        |> PG.order [ PG.asc .id ]
        |> PG.list PG.noLimit "http://localhost:8000/"