Skip to content

RedShift1/postgraphile-plugin-numeral

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postgraphile-plugin-numeral

Adds numeral.js support to PostGraphile for all int fields in the database.

By default the new fields will be named column name + Numeral, for example fileSizeNumeral

GraphiQL Screenshot

Usage

Add PostGraphilePluginNumeral to appendPlugins.

import express from 'express';
import postgraphile from 'postgraphile';
import PostGraphilePluginNumeral from 'postgraphile-plugin-numeral';

const app = express();

app.use(
    postgraphile(
        process.env.DATABASE_URL || 'postgres://user:pass@host:5432/dbname',
        'public',
        {
            appendPlugins:
            [
                PostGraphilePluginNumeral()
            ],
            watchPg: true,
            graphiql: true,
            enhanceGraphiql: true,
        }
    )
);

app.listen(process.env.PORT || 3000);

API

PostGraphilePluginNumeral([nameFn])

Constructs the plugin with an optional name function. The name function determines how the numeral fields will be named in the GraphQL schema.

  • nameFn - function(name: string): string, called when a name is generated for the numeral field. The returned string is used as the new field's name

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published