I am using Golang + RethinkDB (Gorethnkdb v.5). I'm subscribing for changes in a "posts" table. And It works on a half: I prints on changes (means it actually works on detecting changes) but structs are empty after all :(
{"Id":"","IP":"","TS":0,"auth":"","body":"","check":"","Status":""}
Here is my code.
func WatchPosts() {
cursor, err := r.Table("posts").Changes().Run(Session)
if err != nil {
fmt.Println(err)
}
var post Post
for cursor.Next(&post) {
data, err := json.Marshal(post)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}
}
I want to receive structs with data. How should I fix it. Please help me. Thanks in advance