Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 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
  • Sep 15 18:04
    CodyDWJones edited #498
  • Sep 15 18:04
    CodyDWJones edited #498
  • Sep 15 18:01
    CodyDWJones synchronize #498
  • Sep 15 05:38
    CodyDWJones commented #497
  • Sep 15 05:37
    CodyDWJones edited #497
  • Sep 15 05:36
    CodyDWJones edited #497
  • Sep 15 05:29
    CodyDWJones synchronize #498
  • Sep 15 05:27
    CodyDWJones synchronize #498
  • Sep 14 00:40
    srh commented #497
  • Sep 10 19:37
    CodyDWJones opened #497
  • Sep 09 18:18
    CodyDWJones synchronize #496
  • Sep 09 02:57
    CodyDWJones edited #496
  • Sep 09 00:29
    CodyDWJones synchronize #496
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