Skip to content

Instantly share code, notes, and snippets.

View codedmart's full-sized avatar

Brandon Martin codedmart

View GitHub Profile
package com.scalaRethinkdb
object VersionDummy {
trait Version extends Wire {
val fromWire = (str: String) => str match {
case "V0_3" => V0_3
case "V0_4" => V0_4
case _ => throw new RethinkDbUnexpectedResponseError("Some error.")
}
}
package com.scalaRethinkdb
import java.io.{InputStream, OutputStream, IOException}
import java.net.{InetSocketAddress, Socket}
import java.util.concurrent.atomic.AtomicInteger
import com.scalaRethinkdb.utils.{pack, unpack}
object r {
val DEFAULT_HOST = "localhost"
private def read(): Array[Byte] = {
var response: Array[Byte]
def readBuffer(): Array[Byte] {
var buffer = in.read()
buffer match { // Getting error here
case 0 => response
case _ => {
response ++= buffer
readBuffer()
sealed trait Version extends Wire
case object V0_3 extends Version {
val toWire = 0x5f75e83e
val fromWire = "V0_3"
}
case object V0_4 extends Version {
val toWire = 0x400c2d20
val fromWire = "V0_4"
data Version = V0_1 | V0_2 | V0_3 | V0_4
deriving (Eq, Show)
instance WireValue Version where
toWire V0_1 = 0x3f61ba36
toWire V0_2 = 0x723081e1
toWire V0_3 = 0x5f75e83e
toWire V0_4 = 0x400c2d20
fromWire 0x3f61ba36 = Just V0_1
fromWire 0x723081e1 = Just V0_2
fromWire 0x5f75e83e = Just V0_3
db.table('patterns').filter(lambda row:
r.expr(pattern_ids).split(', ').contains(row['id']).not_()
).run()
model
.merge(function(m) {
return {merge: 'Yeah for merge!'};
})
.getJoin(joins)
.run()
.then(function(results) {
// none of the results have merge
console.log(results);
})
var q = require('q');
var r = require('rethinkdbdash')();
var Connection = (function () {
function Connection(options) {
this.options = options;
this.dbname = options.db;
this.db = r.db(options.db);
}
Connection.prototype.run = function (exp) {
@codedmart
codedmart / error
Last active August 29, 2015 14:14
Possibly unhandled From previous event:
at new Promise (/Users/bmartin/Work/modifyink/node_modules/rethinkdb/node_modules/bluebird/js/main/promise.js:84:37)
at TableCreate.TermBase.run (/Users/bmartin/Work/modifyink/node_modules/rethinkdb/ast.js:142:16)
at Connection.run (/Users/bmartin/Work/modifyink/server/lib/rdb.js:16:13)
at Object.init (/Users/bmartin/Work/modifyink/server/lib/rethinkdb-crud.js:76:17)
at Object.init (/Users/bmartin/Work/modifyink/server/lib/rethinkdb-crud.js:46:28)
at Model.init (/Users/bmartin/Work/modifyink/server/model/admin-controlled-settings.js:31:26)
at /Users/bmartin/Work/modifyink/server/config.js:242:50
at _fulfilled (/Users/bmartin/Work/modifyink/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/Users/bmartin/Work/modifyink/node_modules/q/q.js:827:30)
// Turn this into
{
one: {
a: {id: 1},
b: {id: 2}
},
two: {
c: {id: 3},
d: {id: 4}
},