Skip to content

postez 1.0.0

Install from the command line:
Learn more about npm packages
$ npm install @danielivanovz/postez@1.0.0
Install via package.json:
"@danielivanovz/postez": "1.0.0"

About this version

postez

Utility tool for dynamically generate interfaces and types from PostgreSQL using custom schema.

Usage

Define a schema as

schema = {
 'string': [ 'bpchar', 'char', 'varchar', 'text', 'citext', 'uuid' ],
 'number': ['int2', 'int4', 'int8', 'float4', 'float8', 'numeric' ],
 'boolean': ['bool', 'boolean'],
 'Date': ['date', 'timestamp', 'timestamptz'],
 'Array<number>': ['_int2', '_int4', '_int8', '_float4', '_float8', '_numeric', '_money'],
 'Array<boolean>': ['_bool', '_boolean'],
 'Array<string>': ['_varchar', '_text', '_citext', '_uuid', '_bytea'],
 'Object': ['json', 'jsonb'],
 'Array<Object>': ['_json', '_jsonb'],
 'Array<Date>': ['_timestamptz'],
 'CustomTypes': [
  {
   name: 'point',
   type: 'Coordinates',
   definition: 'export interface Coordinates { x: number; y: number; }',
  },
 ],
}

then just pass it as an argument with a database connection and output path:

await postez(db, __dirname.replace('dist', 'src/output'), schema)

Todo

  • add CLI usage

License

Distributed under the MIT License. See LICENSE for more information.

Details


Assets

  • postez-1.0.0-npm.tgz

Download activity

  • Total downloads 1
  • Last 30 days 0
  • Last week 0
  • Today 0

Recent versions

View all