// CAST('2023-01-01' AS DATE)
User.findAll({
attributes: [[cast('2023-01-01', 'DATE'), 'dateOnly']]
})
// CAST(column AS INTEGER)
User.findAll({
attributes: [[cast(col('amount'), 'INTEGER'), 'amountInt']]
})
// CAST with different types
cast(col('price'), 'DECIMAL(10,2)')
cast(col('text'), 'CHAR(100)')
cast(col('json_data'), 'JSON')
Create a CAST expression for type casting SQL: CAST(value AS type)