cws-ts-generator

0.2.6 • Public • Published
`npm install -g cws-ts-generator`
  • This script will create a dir named output in your root directory

  • Inside output will be a dir: persistent-classes, a file: [app-name].generated.d.ts, and a file: Orm.ts

###CLI:
cws-ts-generator -d <database> -u <user> -x <pass> -h <host> -d <dialect> -p <port> -s <skipTables> -t <throughTableIdentifiers> -r <shouldWriteRelations> -l <lookup tableName>,<lookup.start | null>,<lookup.end | null>

###Programmatically:

    let cwsGenerate = require("cws-ts-generator");

    const configOptions = {
        config: {
            db: "db name",
            user: "user name",
            pass: "password",
            host: 'host',
            dialect: "mssql | postgresql | mysql"
        },
        skipTables: ["tableToSkip", "otherTableToSkip", "etc"],   // examples to skip
        primaryKeyIdentifier: "yourPrimaryKeyForEveryTable",             // common name of primary key
        throughTableIdentifiers: ["2", "Map"],   // these substrings are in every map table, so generator can properly map `through` tables
        lookup: {                 
            tableName: "Lookup",  // for constant table that maps keys to value
            start: "lkp",        // start of created extra prop
            end: "OidObject"     // end of created extra prop
        },
        shouldWriteRelations: true   // write extra props defining one:many, many:many relationships
    };


    // execute generator
    cwsGenerate.exec(configOptions).then((res) => {
        console.log(res);
    })

Readme

Keywords

none

Package Sidebar

Install

npm i cws-ts-generator

Weekly Downloads

2

Version

0.2.6

License

MIT

Unpacked Size

253 kB

Total Files

185

Last publish

Collaborators

  • dlemburg