sequelize fn function code example
Example 1: sequelize.fn
// Counting number of totalPrice from column itemPrice table
Model.findAll({
attributes: {
include: [
[sequelize.fn('COUNT', sequelize.col('itemPrice')), 'totalPrice']
]
}
});
Example 2: sequelize.fn
// for gettting all username in uppercase
instance.update({
username: sequelize.fn('upper', sequelize.col('username'))
});