Tuesday, December 3, 2019

Node.js sequelize MySQL JSON function 사용하기

select * from actionlog where JSON_EXTRACT(action, '$name')='reward'

const actionLogs: ActionLog[] = await ActionLog.findAll({
    where: Sequelize.where(
        Sequelize.fn('JSON_EXTRACT',
            Sequelize.col('action'),
            '$.name'),
        'reward')
})