zoukankan      html  css  js  c++  java
  • nodejs sequelize 对应数据库操作符的定义

    const Op = Sequelize.Op
    
    [Op.and]: {a: 5}           // 且 (a = 5)
    [Op.or]: [{a: 5}, {a: 6}]  // (a = 5 或 a = 6)
    [Op.gt]: 6,                // id > 6
    [Op.gte]: 6,               // id >= 6
    [Op.lt]: 10,               // id < 10
    [Op.lte]: 10,              // id <= 10
    [Op.ne]: 20,               // id != 20
    [Op.eq]: 3,                // = 3
    [Op.not]: true,            // 不是 TRUE
    [Op.between]: [6, 10],     // 在 6 和 10 之间
    [Op.notBetween]: [11, 15], // 不在 11 和 15 之间
    [Op.in]: [1, 2],           // 在 [1, 2] 之中
    [Op.notIn]: [1, 2],        // 不在 [1, 2] 之中
    [Op.like]: '%hat',         // 包含 '%hat'
    [Op.notLike]: '%hat'       // 不包含 '%hat'
    [Op.iLike]: '%hat'         // 包含 '%hat' (不区分大小写)  (仅限 PG)
    [Op.notILike]: '%hat'      // 不包含 '%hat'  (仅限 PG)
    [Op.regexp]: '^[h|a|t]'    // 匹配正则表达式/~ '^[h|a|t]' (仅限 MySQL/PG)
    [Op.notRegexp]: '^[h|a|t]' // 不匹配正则表达式/!~ '^[h|a|t]' (仅限 MySQL/PG)
    [Op.iRegexp]: '^[h|a|t]'    // ~* '^[h|a|t]' (仅限 PG)
    [Op.notIRegexp]: '^[h|a|t]' // !~* '^[h|a|t]' (仅限 PG)
    [Op.like]: { [Op.any]: ['cat', 'hat']} // 包含任何数组['cat', 'hat'] - 同样适用于 iLike 和 notLike
    [Op.overlap]: [1, 2]       // && [1, 2] (PG数组重叠运算符)
    [Op.contains]: [1, 2]      // @> [1, 2] (PG数组包含运算符)
    [Op.contained]: [1, 2]     // <@ [1, 2] (PG数组包含于运算符)
    [Op.any]: [2,3]            // 任何数组[2, 3]::INTEGER (仅限PG)
    [Op.col]: 'user.organization_id' // = 'user'.'organization_id', 使用数据库语言特定的列标识符, 本例使用 PG
    $and: {a: 5}           // AND (a = 5)
    $or: [{a: 5}, {a: 6}]  // (a = 5 OR a = 6)
    $gt: 6,                // > 6
    $gte: 6,               // >= 6
    $lt: 10,               // < 10
    $lte: 10,              // <= 10
    $ne: 20,               // != 20
    $not: true,            // IS NOT TRUE
    $between: [6, 10],     // BETWEEN 6 AND 10
    $notBetween: [11, 15], // NOT BETWEEN 11 AND 15
    $in: [1, 2],           // IN [1, 2]
    $notIn: [1, 2],        // NOT IN [1, 2]
    $like: '%hat',         // LIKE '%hat'
    $notLike: '%hat'       // NOT LIKE '%hat'
    $iLike: '%hat'         // ILIKE '%hat' (case insensitive) (PG only)
    $notILike: '%hat'      // NOT ILIKE '%hat'  (PG only)
    $like: { $any: ['cat', 'hat']}
                           // LIKE ANY ARRAY['cat', 'hat'] - also works for iLike and notLike
    $overlap: [1, 2]       // && [1, 2] (PG array overlap operator)
    $contains: [1, 2]      // @> [1, 2] (PG array contains operator)
    $contained: [1, 2]     // <@ [1, 2] (PG array contained by operator)
    $any: [2,3]            // ANY ARRAY[2, 3]::INTEGER (PG only)
    
    $col: 'user.organization_id' // = "user"."organization_id", with dialect specific column identifiers, PG in this example

    参考网址:

    https://itbilu.com/nodejs/npm/VJIR1CjMb.html

    https://blog.csdn.net/millions_02/article/details/79361795

  • 相关阅读:
    2018 ACM 网络选拔赛 徐州赛区
    2018 ACM 网络选拔赛 焦作赛区
    2018 ACM 网络选拔赛 沈阳赛区
    poj 2289 网络流 and 二分查找
    poj 2446 二分图最大匹配
    poj 1469 二分图最大匹配
    poj 3249 拓扑排序 and 动态规划
    poj 3687 拓扑排序
    poj 2585 拓扑排序
    poj 1094 拓扑排序
  • 原文地址:https://www.cnblogs.com/zhaomeizi/p/9242372.html
Copyright © 2011-2022 走看看