postgrest-9.0.1: REST API for any Postgres database
Safe HaskellNone
LanguageHaskell2010

PostgREST.Query.SqlFragment

Description

Any function that outputs a SqlFragment should be in this module.

Synopsis

Documentation

type SqlFragment = ByteString Source #

A part of a SQL query that cannot be executed independently

normalizedBody :: Maybe ByteString -> Snippet Source #

These CTEs convert a json object into a json array, this way we can use json_populate_recordset for all json payloads Otherwise we'd have to use json_populate_record for json objects and json_populate_recordset for json arrays We do this in SQL to avoid processing the JSON in application code TODO: At this stage there shouldn't be a Maybe since ApiRequest should ensure that an INSERT/UPDATE has a body