Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 26 22:12
    CodyDWJones edited #499
  • Sep 26 22:12
    CodyDWJones opened #499
  • Sep 26 20:07
    CodyDWJones closed #498
  • Sep 24 17:24
    CodyDWJones commented #497
  • Sep 24 17:06
    CodyDWJones closed #497
  • Sep 23 21:42
    CodyDWJones commented #498
  • Sep 23 14:35
    CMogilko commented #498
  • Sep 23 13:49

    CMogilko on master

    Upgrade to Python 3.8 (#496) *… (compare)

  • Sep 23 13:49
    CMogilko closed #496
  • Sep 23 13:47

    CMogilko on master

    Make it easier for new contribu… (compare)

  • Sep 23 13:47
    CMogilko closed #495
  • Sep 23 13:45

    CMogilko on master

    Fix failing Travis CI jobs (#49… (compare)

  • Sep 23 13:45
    CMogilko closed #494
  • Sep 20 16:40
    CodyDWJones edited #498
  • Sep 16 16:47
    CodyDWJones synchronize #498
  • Sep 16 16:26
    CodyDWJones synchronize #498
  • Sep 16 05:23
    CodyDWJones synchronize #498
  • Sep 16 03:47
    CodyDWJones synchronize #498
  • Sep 15 23:55
    CodyDWJones synchronize #498
  • Sep 15 18:10
    CodyDWJones synchronize #498
Daniel Cannon
@dancannon
{"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