Skip to content

Instantly share code, notes, and snippets.

@lirongfei123
Last active March 9, 2019 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lirongfei123/4fea6a9affc0498061a657037b418152 to your computer and use it in GitHub Desktop.
Save lirongfei123/4fea6a9affc0498061a657037b418152 to your computer and use it in GitHub Desktop.
sequelize #sequelize
$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
eq: symbol;
        ne: symbol;
        gte: symbol;
        gt: symbol;
        lte: symbol;
        lt: symbol;
        not: symbol;
        is: symbol;
        in: symbol;
        notIn: symbol;
        like: symbol;
        notLike: symbol;
        iLike: symbol;
        notILike: symbol;
        regexp: symbol;
        notRegexp: symbol;
        iRegexp: symbol;
        notIRegexp: symbol;
        between: symbol;
        notBetween: symbol;
        overlap: symbol;
        contains: symbol;
        contained: symbol;
        adjacent: symbol;
        strictLeft: symbol;
        strictRight: symbol;
        noExtendRight: symbol;
        noExtendLeft: symbol;
        and: symbol;
        or: symbol;
        any: symbol;
        all: symbol;
        values: symbol;
        col: symbol;
        placeholder: symbol;
        join: symbol;
        raw: symbol;  //deprecated remove by v5.0
        ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment