How to use the rethinkdb.literal function in rethinkdb

To help you get started, we’ve selected a few rethinkdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wfjsw / osiris-groupindexer / plugins / gpindex_countmember.js View on Github external
async function refreshOnGetDetail(msg, result, bot) {
    try {
        let gid = parseInt(result[1])
        if (gid > 0) return
        const record = await comlib.getRecord(gid)
        if (!record) return
        // if (!record.type == 'channel' && !record.is_public) return
        let member_count = 0
        try {
            member_count = await bot.getChatMembersCount(gid)
        } catch (e) {
            member_count = await tmeassist.getMemberCount(record.is_public ? `https://t.me/${record.username}` : record.invite_link)
            if (!member_count) member_count = require('rethinkdb').literal()
        }
        return await comlib.silentUpdate(gid, {
            member_count
        })
    } catch (e) {
        console.error(e.message)
    }
}
github samuelcardillo / MMORPGMaker-MV / server / core / database.js View on Github external
onConnect(function(err, conn) {
    let query = r.db("mmorpg").table("config")(0);

    if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
    else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
    else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
    else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
    else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})

    query.run(conn)
      .then(function(cursor) { return cursor; })
      .then(function(output) {
        exports.reloadConfig(() => {
          console.log("[I] Server configuration changes saved.");        
        });
        callback();
      })
      .finally(() => { conn.close(); })
  })
}
github samuelcardillo / MMORPGMaker-MV / server / core / database.js View on Github external
onConnect(function(err, conn) {
    let query = r.db("mmorpg").table("config")(0);

    if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
    else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
    else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
    else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
    else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})

    query.run(conn)
      .then(function(cursor) { return cursor; })
      .then(function(output) {
        exports.reloadConfig(() => {
          console.log("[I] Server configuration changes saved.");        
        });
        callback();
      })
      .finally(() => { conn.close(); })
  })
}
github mikemintz / rethinkdb-websocket-server / src / ReqlTermExamples.js View on Github external
FRIDAY: r.friday,
  SATURDAY: r.saturday,
  SUNDAY: r.sunday,
  JANUARY: r.january,
  FEBRUARY: r.february,
  MARCH: r.march,
  APRIL: r.april,
  MAY: r.may,
  JUNE: r.june,
  JULY: r.july,
  AUGUST: r.august,
  SEPTEMBER: r.september,
  OCTOBER: r.october,
  NOVEMBER: r.november,
  DECEMBER: r.december,
  LITERAL: r.literal({}),
  GROUP: r([]).group(''),
  SUM: r([]).sum(),
  AVG: r([]).avg(),
  MIN: r([]).min(),
  MAX: r([]).max(),
  SPLIT: r([]).split(),
  UNGROUP: r([]).ungroup(),
  RANDOM: r.random(),
  CHANGES: r([]).changes(),
  ARGS: r.args([]),
  BINARY: r.binary(new Buffer(0)),
  GEOJSON: r.geojson({}),
  TO_GEOJSON: r({}).toGeojson(),
  POINT: r.point(0, 0),
  LINE: r.line([], []),
  POLYGON: r.polygon([], [], []),
github samuelcardillo / MMORPGMaker-MV / server / core / database.js View on Github external
onConnect(function(err, conn) {
    let query = r.db("mmorpg").table("config")(0);

    if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
    else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
    else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
    else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
    else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})

    query.run(conn)
      .then(function(cursor) { return cursor; })
      .then(function(output) {
        exports.reloadConfig(() => {
          console.log("[I] Server configuration changes saved.");        
        });
        callback();
      })
      .finally(() => { conn.close(); })
  })
}
github samuelcardillo / MMORPGMaker-MV / server / core / database.js View on Github external
onConnect(function(err, conn) {
    let query = r.db("mmorpg").table("config")(0);

    if(type === "globalSwitches") query = query.update({"globalSwitches": r.literal(payload)})
    else if(type === "partySwitches") query = query.update({"partySwitches": r.literal(payload)})
    else if(type === "offlineMaps") query = query.update({"offlineMaps": r.literal(payload)})
    else if(type === "globalVariables") query = query.update({"globalVariables": r.literal(payload)})
    else if(type === "newPlayerDetails") query = query.update({"newPlayerDetails": r.literal(payload)})

    query.run(conn)
      .then(function(cursor) { return cursor; })
      .then(function(output) {
        exports.reloadConfig(() => {
          console.log("[I] Server configuration changes saved.");        
        });
        callback();
      })
      .finally(() => { conn.close(); })
  })
}
github wfjsw / osiris-groupindexer / lib / gpindex_common.js View on Github external
async function removeUserFlag(uid, flag) {
    let updation = {}
    if (Array.isArray(flag)) {
        for (let i of flag) {
            updation[i] = r.literal()
        }
    } else {
        updation[flag] = r.literal()
    }
    return r.table('userdata').get(parseInt(uid)).update(updation)
}
github openstf / stf / lib / db / tables.js View on Github external
indexFunction: function(device) {
          return r.branch(
            device('present')
          , device('owner')('email')
          , r.literal()
          )
        }
      }
github davidgljay / nametag / horizon / cli / src / migrate.js View on Github external
return Promise.resolve().then(() => {
    white('Rewriting hz_collections to new format')
    return r.db(project).table('hz_collections')
      .update({ table: r.literal() })
      .run(this.conn)
  }).then(() => green(' ├── "table" field removed'))
    .then(() => r.db(project).table('hz_collections')
github openstf / stf / lib / db / api.js View on Github external
dbapi.resetUserSettings = function(email) {
  return db.run(r.table('users').get(email).update({
    settings: r.literal({})
  }))
}

rethinkdb

This package provides the JavaScript driver library for the RethinkDB database server for use in your node application.

Unknown
Latest version published 5 years ago

Package Health Score

58 / 100
Full package analysis