How to use the DECIMAL function from sequelize

Find comprehensive JavaScript sequelize.DECIMAL code examples handpicked from public code repositorys.

239
240
241
242
243
244
245
246
247
248
    key: 'Id'
  },
  field: 'CustomerId'
},
totalAmount: {
  type: DataTypes.DECIMAL(12,2),
  allowNull: true,
  defaultValue: 0.00,
  field: 'TotalAmount'
},
fork icon500
star icon0
watch icon59

+ 3 other calls in file

112
113
114
115
116
117
118
119
120
121
  type: Seq.INTEGER(6),
  comment: '支付类型',
  field: 'pay_type'
},
price: {
  type: Seq.DECIMAL(6, 2),
  comment: '价格',
  field: 'price'
},
...time.create_date
fork icon115
star icon516
watch icon11

34
35
36
37
38
39
40
41
42
43
exports._FLOAT0    = Sequelize.FLOAT;
exports._FLOAT1    = Sequelize.FLOAT;
exports._DOUBLE    = Sequelize.DOUBLE;
exports._DOUBLE0   = Sequelize.DOUBLE;
exports._DOUBLE1   = Sequelize.DOUBLE;
exports._DECIMAL   = Sequelize.DECIMAL;
exports._DECIMAL0  = Sequelize.DECIMAL;
exports._REAL      = Sequelize.REAL;
exports._REAL0     = Sequelize.REAL;
exports._REAL1     = Sequelize.REAL;
fork icon10
star icon15
watch icon25

+ 19 other calls in file

12
13
14
15
16
17
18
19
20
21
name: {
  type: Sequelize.STRING(1024),
  field: 'name',
},
amount: {
  type: Sequelize.DECIMAL(19, 4),
},
quantity: {
  type: Sequelize.FLOAT,
  field: 'qty',
fork icon1
star icon6
watch icon2

+ 3 other calls in file

218
219
220
221
222
223
224
225
226
227
  },
  unique: true,
  field: 'CustomerId'
},
totalAmount: {
  type: DataTypes.DECIMAL(19,4),
  allowNull: true,
  defaultValue: 0,
  field: 'TotalAmount'
}
fork icon497
star icon0
watch icon0

10
11
12
13
14
15
16
17
18
19
  },
  destination: {
    type: Sequelize.GEOMETRY('POINT')
  },
  price: {
    type: Sequelize.DECIMAL
  }
});

module.exports = Route;
fork icon4
star icon0
watch icon3

2
3
4
5
6
7
8
9
10
11
const { STRING, DECIMAL, INTEGER, VIRTUAL, BOOLEAN } = require('sequelize');

module.exports = db =>
        db.define('orderItem', {
                price: {
                        type: DECIMAL(10, 2),
                        allowNull: false,
                        validate: {
                                min: 0
                        }
fork icon1
star icon2
watch icon3

5
6
7
8
9
10
11
12
13
14
name: {
        type: Sequelize.STRING,
        allowNull: false
},
price: {
        type: Sequelize.DECIMAL(10, 2),
        allowNull: false,
        defaultValue: 0
},
description: {
fork icon1
star icon0
watch icon5

98
99
100
101
102
103
104
105
106
107
 * @param {*} opts 
 * @returns {Object}
 */
number: (opts = {}) => {
    var ret = {
        type: Sequelize.DECIMAL(10, 5),
        allowNull: true,
        get(nome) {
            return muttations.number.get(this, nome);
        }
fork icon0
star icon0
watch icon2