Skip to content

Instantly share code, notes, and snippets.

View codedmart's full-sized avatar

Brandon Martin codedmart

View GitHub Profile
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) {
model
.merge(function(m) {
return {merge: 'Yeah for merge!'};
})
.getJoin(joins)
.run()
.then(function(results) {
// none of the results have merge
console.log(results);
})
db.table('patterns').filter(lambda row:
r.expr(pattern_ids).split(', ').contains(row['id']).not_()
).run()
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
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"
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()
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"
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
object VersionDummy {
trait Version extends Wire[Version] {
def fromWire(a: Int): Version = a match {
case 0x5f75e83e => V0_3
case 0x400c2d20 => V0_4
case _ => throw new RethinkDbUnexpectedResponseError("Version not found.")
}
}
package com.scalaRethinkdb
object VersionDummy {
sealed abstract class Version
object V0_3 extends Version
object V0_4 extends Version
object Version {
implicit object instances extends Wire[Version] {
def toWire(a: Version): Int = a match {