lext-7 / sequelizex

some useful utilities for sequelize, such as simeple datatype

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sequelizex

some useful utilities for sequelize, such as simeple datatype.

Installation

  npm install sequelize-x

simpel Datatype

var sequelizex = require('sequelize-x');
var shortDataTypes = sequelizex.DataTypes;

module.exports = function (sequelize, DataTypes) {

  var Model = sequelize.define('Model', {

    string: shortDataTypes.String(),
    stringWithMaxlength: shortDataTypes.String(256),
    stringAllowNull: shortDataTypes.String(null, true),

    double: shortDataTypes.Double(),
    doubleWithCustomDefaultValue: shortDataTypes.Double(10),

    int: shortDataTypes.Int(),
    intWithCustomDefaultValue: shortDataTypes.Int(10),

    phone: shortDataTypes.Phone(true),
    phoneAllowNull: shortDataTypes.Phone(true),

    text: shortDataTypes.Text(),

    time: shortDataTypes.Date(),
  });

  return Model;
};

About

some useful utilities for sequelize, such as simeple datatype


Languages

Language:JavaScript 100.0%