From cc54135bf0b1e635f2ff56c6899401c653b6281a Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 28 Dec 2020 21:35:36 +0100 Subject: [PATCH] Rename master branch to main; replace whiteList with isAllowed --- .codecov.yml | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 2 +- README.md | 8 ++++---- nix/UPGRADE.md | 4 ++-- nix/release/docker-hub-full-description.md | 4 ++-- src/PostgREST/Private/QueryFragment.hs | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 26cfb9162..d9ed1083f 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,5 +1,5 @@ codecov: - branch: master + branch: main require_ci_to_pass: false comment: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e77a15cef..0d782474f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ diff --git a/README.md b/README.md index 4cf06b018..4e3dbc4cf 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ [![Join the chat at https://gitter.im/begriffs/postgrest](https://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/begriffs/postgrest) [![Docs](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](http://postgrest.org) [![Docker Stars](https://img.shields.io/docker/pulls/postgrest/postgrest.svg)](https://hub.docker.com/r/postgrest/postgrest/) -[![Build Status](https://circleci.com/gh/PostgREST/postgrest/tree/master.svg?style=shield)](https://circleci.com/gh/PostgREST/postgrest/tree/master) -[![Coverage Status](https://img.shields.io/codecov/c/github/postgrest/postgrest/master)](https://app.codecov.io/gh/PostgREST/postgrest) +[![Build Status](https://circleci.com/gh/PostgREST/postgrest/tree/main.svg?style=shield)](https://circleci.com/gh/PostgREST/postgrest/tree/main) +[![Coverage Status](https://img.shields.io/codecov/c/github/postgrest/postgrest/main)](https://app.codecov.io/gh/PostgREST/postgrest) [![Hackage docs](https://img.shields.io/hackage/v/postgrest.svg?label=hackage)](http://hackage.haskell.org/package/postgrest) PostgREST serves a fully RESTful API from any existing PostgreSQL @@ -151,8 +151,8 @@ Every donation will be spent on making PostgREST better for the whole community. The PostgREST organization is grateful to: -- The project [sponsors and backers](https://github.com/PostgREST/postgrest/blob/master/BACKERS.md) who support PostgREST's development. +- The project [sponsors and backers](https://github.com/PostgREST/postgrest/blob/main/BACKERS.md) who support PostgREST's development. - The project [contributors](https://github.com/PostgREST/postgrest/graphs/contributors) who have improved PostgREST immensely with their code - and good judgement. See more details in the [changelog](https://github.com/PostgREST/postgrest/blob/master/CHANGELOG.md). + and good judgement. See more details in the [changelog](https://github.com/PostgREST/postgrest/blob/main/CHANGELOG.md). The cool logo came from [Mikey Casalaina](https://github.com/casalaina). diff --git a/nix/UPGRADE.md b/nix/UPGRADE.md index c561a804a..99be8228e 100644 --- a/nix/UPGRADE.md +++ b/nix/UPGRADE.md @@ -18,7 +18,7 @@ The following checklist guides you through the complete process in more detail. The pinned version of [`nixpkgs`](https://github.com/NixOS/nixpkgs) is defined in [`nix/nixpkgs-version.nix`](nixpkgs-version.nix). The pin refers directly to a GitHub tarball for the given revision, which is more efficient than pulling -the complete Git repository. To upgrade it to the current `master` of +the complete Git repository. To upgrade it to the current `main` of `nixpkgs`, you can use a small utility script defined in [`nix/nixpkgs-update.nix`](nixpkgs-update.nix): @@ -26,7 +26,7 @@ the complete Git repository. To upgrade it to the current `master` of # From the root of the repository, enter nix-shell nix-shell -# Run the utility script to pin the latest revision in master +# Run the utility script to pin the latest revision in main postgrest-nixpkgs-upgrade # Exit the nix-shell with Ctrl-d diff --git a/nix/release/docker-hub-full-description.md b/nix/release/docker-hub-full-description.md index 9f42096a1..112165cef 100644 --- a/nix/release/docker-hub-full-description.md +++ b/nix/release/docker-hub-full-description.md @@ -4,7 +4,7 @@ [![Donate](https://img.shields.io/badge/Donate-Patreon-orange.svg?colorB=F96854)](https://www.patreon.com/postgrest) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/postgrest) [![Docs](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](http://postgrest.org) -[![Build Status](https://circleci.com/gh/PostgREST/postgrest/tree/master.svg?style=shield)](https://circleci.com/gh/PostgREST/postgrest/tree/master) +[![Build Status](https://circleci.com/gh/PostgREST/postgrest/tree/main.svg?style=shield)](https://circleci.com/gh/PostgREST/postgrest/tree/main) PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant, faster API than you are likely to @@ -24,5 +24,5 @@ The image is built from scratch using [Nix](https://nixos.org/nixpkgs/manual/#sec-pkgs-dockerTools) instead of a `Dockerfile`, which yields a higly secure and optimized image. This is also why no commands are listed in the image history. See the [PostgREST -respository](https://github.com/PostgREST/postgrest/tree/master/nix/docker) for +respository](https://github.com/PostgREST/postgrest/tree/main/nix/docker) for details on the build process and how to inspect the image. diff --git a/src/PostgREST/Private/QueryFragment.hs b/src/PostgREST/Private/QueryFragment.hs index f669bdaf7..c408fbfd8 100644 --- a/src/PostgREST/Private/QueryFragment.hs +++ b/src/PostgREST/Private/QueryFragment.hs @@ -148,7 +148,7 @@ pgFmtFilter table (Filter fld (OpExpr hasNot oper)) = notOp <> " " <> case oper Op op val -> pgFmtFieldOp op <> " " <> case op of "like" -> unknownLiteral (T.map star val) "ilike" -> unknownLiteral (T.map star val) - "is" -> whiteList val + "is" -> isAllowed val _ -> unknownLiteral val -- We don't use "IN", we use "= ANY". IN has the following disadvantages: @@ -172,8 +172,8 @@ pgFmtFilter table (Filter fld (OpExpr hasNot oper)) = notOp <> " " <> case oper -- IS cannot be prepared. `PREPARE boolplan AS SELECT * FROM projects where id IS $1` will give a syntax error. -- The above can be fixed by using `PREPARE boolplan AS SELECT * FROM projects where id IS NOT DISTINCT FROM $1;` -- However that would not accept the TRUE/FALSE/NULL keywords. See: https://stackoverflow.com/questions/6133525/proper-way-to-set-preparedstatement-parameter-to-null-under-postgres. - whiteList :: Text -> H.Snippet - whiteList v = H.sql $ maybe + isAllowed :: Text -> H.Snippet + isAllowed v = H.sql $ maybe (pgFmtLit v <> "::unknown") encodeUtf8 (find ((==) . T.toLower $ v) ["null","true","false"])