You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to run a filter on a property of a nested object for RethinkDB in Golang. But I am sure that I am missing something here. Could you please help me out?
This is the error I am getting:
(func literal).Eq undefined (type func(gorethink.Term) gorethink.Term has no field or method Eq)
Here is my code:
type User struct {
Id string `json:"id,omitempty"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Email string `json:"email,omitempty"`
Password string `json:"password,omitempty"`
Salt string `json:"salt,omitempty"`
}
type UnverifiedUserRequest struct {
Id string `json:"id,omitempty"`
Token string `json:"token,omitempty"`
User User `json:"user,omitempty"`
}
db.Table("unverified_requests").Filter(func(row r.Term) r.Term {
return row.Field("user").Map(func(user r.Term) r.Term {
return user.Field("email")
}.Eq(email))
}).Run(session)
The text was updated successfully, but these errors were encountered:
You are missing the closing ) for the .Map function.
Something like this should at least compile, but it will fail with: Cannot convert STRING to SEQUENCE.
I think that the best approach to your query would be using filter with a function argument . The documentation of the javascript can be very helpful, you can check it out here .
I've created a gist for your specific question, I hope it works for you
I am trying to run a filter on a property of a nested object for RethinkDB in Golang. But I am sure that I am missing something here. Could you please help me out?
This is the error I am getting:
Here is my code:
The text was updated successfully, but these errors were encountered: