express-sweet
Advanced tools
Changelog
[1.0.12] - 2021/11/16
// By default the function will return two arguments - a results array, and an object containing metadata (such as amount of affected rows, etc).
// Note that since this is a raw query, the metadata are dialect specific.
const [results, metadata] = await BookModel.query("UPDATE book SET title = 'When Im Gone' WHERE id = 1");
// In cases where you don't need to access the metadata you can pass in a query type to tell sequelize how to format the results. For example, for a simple select query you could do:
// We didn't need to destructure the result here - the results were returned directly
const users = await BookModel.query("SELECT * FROM book", {type: BookModel.QueryTypes.SELECT});
Changelog
[1.0.11] - 2021/11/10
Changelog
[1.0.10] - 2021/10/19
Changelog
[1.0.8] - 2021/9/25
Changelog
[1.0.7] - 2021/8/13
Changelog
[1.0.6] - 2021/8/13
Changelog
[1.0.5] - 2021/8/12
Changelog
[1.0.4] - 2021/6/13
Changelog
[1.0.3] - 2021/6/13
// For example, when the current URL is "https://example.com/docs/api?q=value", "/docs/api" is set for "app.locals.currentPath".
console.log(app.locals.currentPath);