Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphile-contrib/pg-order-by-multi-column-index

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphile-contrib/pg-order-by-multi-column-index

Order by multi-column indexes on PostGraphile connections

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
130
decreased by-78.11%
Maintainers
4
Weekly downloads
 
Created
Source

@graphile-contrib/pg-order-by-multi-column-index

Package on npm

This Graphile Engine plugin adds enum values to the orderBy argument on connections, allowing you to order by multi-column indexes.

Requires postgraphile@^4.1.0 or graphile-build-pg@^4.1.0

NOTE: If you're not using ignoreIndexes: false, then you probably don't need this plugin.

PostGraphile's ignoreIndexes: false option only exposes the first column of each multi-column index on orderBy. This prevents clients from sending queries with an array of column names/directions that can't make use of the multi-column index. This plugin adds enum values to orderBy that match forward and backward scans of the index.

Example:

create index on p.person (last_name ASC, first_name ASC);
{
  allPeople(orderBy: LAST_NAME_ASC__FIRST_NAME_ASC) {
    nodes {
      id
      firstName
      lastName
    }
  }
}

Usage

Append this plugin and the additional orderBy enum values will be added to your schema.

CLI

yarn add postgraphile
yarn add @graphile-contrib/pg-order-by-multi-column-index
npx postgraphile --append-plugins @graphile-contrib/pg-order-by-multi-column-index

Library

const express = require("express");
const { postgraphile } = require("postgraphile");
const PgOrderByMultiColumnIndexPlugin = require("@graphile-contrib/pg-order-by-multi-column-index");

const app = express();

app.use(
  postgraphile(process.env.DATABASE_URL, "app_public", {
    appendPlugins: [PgOrderByMultiColumnIndexPlugin],
    graphiql: true,
  })
);

app.listen(5000);

FAQs

Package last updated on 02 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc