sequelize-constants

1.0.0 • Public • Published

Sequelize constants plugin

Plugin allow to define constants in sequelize model

Usage

 
const sequelize = new Sequelize( credentials, options );
 
// Use plugin
require('sequelize-constants')( sequelize );
 
const MyModel = sequelize.define('MyModel', {
    /// Here cols defs
}, {
    constant: [
        STATUS_PENDING: 'pending',
        STATUS_RUNNING: 'running',
        STATUS_COMPLETE: 'complete',
        STATUS_ERROR: 'error',
        STATUS_ABORT: 'abort'
    ]
});
 
/// NOW access by
 
console.log( MyModel.STATUS_PENDING );
 
MyModel.STATUS_PENDING = 'foo'; // throw an error, readonly property!
 

Readme

Keywords

Package Sidebar

Install

npm i sequelize-constants

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • qwantix