
User.findAll({
attributes: [
'name', ['password', 'pass'],
],
where: {
email: '[email protected]',
createAt: {
$gte: '1-1-2016',
$lt: '31-12-2016',
},
},
offset: 5,
limit: 5,
})
SELECT name, password AS pass
WHERE email LIKE '[email protected]' AND
(createAt >= '1-1-2016' AND createAt < '31-12-2016') AND
LIMIT 5,10
User.createNewUser = async (user) => {
return await User.sync().then(function () {
// Table created
return User.create({
name: user.username,
password: user.password,
email: user.email
});
});
}
sequelize.query('UPDATE users SET name=test WHERE email = ?',
{ replacements: ['[email protected]'], type: sequelize.QueryTypes.UPDATE }
).then(function(user) {
console.log(user)
})
sequelize.query('UPDATE users SET name=test WHERE email = :email ',
{ replacements: { email: '[email protected]' }, type: sequelize.QueryTypes.UPDATE }
).then(function(user) {
console.log(user)
})