Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 22 19:07
    causton81 opened #468
  • Jul 10 08:54
    DivPro opened #467
  • Jul 10 07:47
    DivPro edited #466
  • Jul 10 07:46
    DivPro edited #466
  • Jul 10 07:46
    DivPro opened #466
  • Jun 01 18:27

    CMogilko on bench

    bench remove rand (compare)

  • May 26 10:13
    pynoable closed #459
  • May 26 10:13
    pynoable commented #459
  • May 15 21:35

    CMogilko on bench

    bench cpuinfo (compare)

  • May 15 21:23

    CMogilko on bench

    benchmark driver not golang (compare)

  • May 14 21:32
    CMogilko synchronize #461
  • May 14 21:32

    CMogilko on develop

    simple connection reusage round… (compare)

  • May 13 21:33
    CMogilko closed #463
  • May 13 21:33

    CMogilko on master

    Update query.go Adds Type fiel… Merge pull request #464 from no… (compare)

  • May 13 21:33
    CMogilko closed #464
  • May 13 21:32
    CMogilko commented #464
  • May 13 21:08
    CMogilko closed #465
  • May 13 21:08
    CMogilko commented #465
  • May 13 20:39
    eclipseo commented #465
  • May 13 20:06
    CMogilko commented #465
Daniel Cannon
@dancannon
@eliezedeck Unfortunately not, for example this is what the driver gets back from RethinkDB
{"t":18,"e":4100000,"r":["Table `examples.games` already exists."],"b":[],"p":[{"duration(ms)":0.343791}]}
Elie Zedeck RANDRIAMIANDRIRAY
@eliezedeck
isn't the "e" item here the error identifier? I mean, for instance, all table already existing error message would always return "e" = 4100000, right?
if that is the case, that might be something that could be exported all the way to the error itself... it's more comfortable to trust the value of the "e" rather that the message that has higher chance of being updated in the future
Daniel Cannon
@dancannon
@eliezedeck Apologies you are completely correct!
The driver spec is missing that field so I completely ignored it haha
If you could create an issue on Github I will make sure it gets added in the next version
Elie Zedeck RANDRIAMIANDRIRAY
@eliezedeck
Sure... :)
Elie Zedeck RANDRIAMIANDRIRAY
@eliezedeck
@dancannon it's done
Daniel Cannon
@dancannon
Great thanks! Not sure when the next release will be but hopefully not too long
Elie Zedeck RANDRIAMIANDRIRAY
@eliezedeck
Cool! Thank YOU!
Suyash Katiyar
@SKatiyar
@dancannon trying to load http://apps.sfgov.org/datafiles/view.php?file=sfgis/citylots.zip data into rethinkdb using gorethink
package main

import "fmt"

import r "github.com/dancannon/gorethink"
import "encoding/json"
import "io/ioutil"
import "reflect"

func main() {
    conn, connErr := r.Connect(r.ConnectOpts{Address: "localhost:21015"})
    if connErr != nil {
        fmt.Println(connErr)
        return
    }

    data, dataErr := ioutil.ReadFile("/Users/home/Downloads/dataset/citylots.json")
    if dataErr != nil {
        fmt.Println(dataErr)
        return
    }

    var jsonData map[string]interface{}
    unmarshalErr := json.Unmarshal(data, &jsonData)
    if unmarshalErr != nil {
        fmt.Println(unmarshalErr)
        return
    }

    val := reflect.ValueOf(jsonData["features"])
    for i := 0; i < val.Len(); i++ {
        _, insertErr := r.DB("tootle").Table("citylots").Insert(val.Index(i).Interface()).Run(conn)
        if insertErr != nil {
            fmt.Println(insertErr)
            return
        }
    }
}
it ends with following Error
dial tcp: lookup localhost: no such host
Nick Stogner
@nstogner
I am trying to create a REST api based by rehtinkdb.... On a POST request where the doc already exists I would like to return a 409-Conflict response. I am not seeing an easy way of differentiating between errors for r.Table("...").Insert(...).RunWrite(...)
William McGann
@tehbilly
Does WriteResponse contain information you could use? Should contain number of inserts, updates, etc.
Nick Stogner
@nstogner
So I can look at the number of docs inserted... but how do I determine between an Internal-Server-Error and a Conflict?
Because if I have conflict set to "error" then the err wont be nil.... And I cant determine the failure cause
consider this code:
result, err := r.Table(Table).Insert(org).RunWrite(h.session) if err != nil { return httperr.New("could not insert org: "+err.Error(), http.StatusInternalServerError) } if result.Inserted == 0 { return httperr.New("organization already exists", http.StatusConflict) }
whoops that didnt look pretty
in this code, the Conflict portion will never be reached b/c the error is non-nil... but if i put reverse the checking... I might return a 409-Conflict when I should have returned a 500- internal-server-error
William McGann
@tehbilly
Hrm, gonna have to think on that for a few. Plus i have a three year old asleep on me right now.
But I am pondering!
Nick Stogner
@nstogner
haha thanks!
William McGann
@tehbilly
Silly question, is the response nil when the err is not?
Nick Stogner
@nstogner
no the response always is non-nil no matter what happens with the err
William McGann
@tehbilly
Sorry, it's been a heck of a day. Central VA, so tornados and blah. Anyways, if there's an error and a response, can use the counts to see if anything was changed iirc. Or, on failure, do another query to see what's there. Should tell you if there's an error between app and db or the error was due to it existing already
On a side note, freaking tornadoes in Virginia. Eesh
Nick Stogner
@nstogner
Yeah the tornadoes came thru NC also...
So it seems to me like there should be an explicit way of determining if a conflict has caused the insert to fail...
The only way I see how to check for a conflict is to parse the error message:
Duplicate primary key id:
Nick Stogner
@nstogner
^^ Wouldn't returning a specific error value from the RunWrite() method or in the WriteResponse be the appropriate way of determining this?
Nick Stogner
@nstogner
I went ahead an opened an issue
William McGann
@tehbilly
I think typed errors would be fantastic, doing a type switch to handle these would be much clearer
SamuelRamond
@SamuelRamond
Hi, just a little message to thank you for the gorethink driver it is awesome :+1:
Daniel Cannon
@dancannon
Thanks @SamuelRamond!
Please use #gorethink on the RethinkDB slack from now on. I will be removing the link from the repo shortly
My reasoning behind this change is that notifications in gitter are not great and the slack has got a pretty good community there now. Sorry for any trouble this causes
Konrad Jarosinski
@iKonrad
Hi guys. Got a quick question. Is there a way to see what ReQL queries are being executed in rethinkDB?
subhamgupta
@subhamgupta
hi guys , got a question , how to update data in rethinkdb from the router
Mads Cordes
@Mobilpadde
Hi!
Anybody who can help with this? GoRethink/gorethink#447
Mads Cordes
@Mobilpadde
Figured why. Just had to run my bin in sudo :flushed:
Schartz Rehan
@schartz

Hello there, I'm noob with gorethink. I am trying to get a simple count and getting confused.
Here is my query:

result, err := r.DB("ecomm").Table("orders").Count(r.Row.Field("user_id").Eq(123654)).Run(rethinkDbSession)

when I return the result
It gives me following error
cannot use result (type *rethinkdb.Cursor) as type int in return argument
My question is how do I get an integer count from above query
I'm sorry if it's a very simple thing
Schartz Rehan
@schartz
Sorry guys.
I figured this. I was being silly