We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The only thing better than a Go gRPC API would be if you guys made it easy to get the data out of protos and into local structures.
type Person struct { ID uuid.UUID `db:"id"` Name string `db:"name"` Age int64 `db:"age"` } // Do expensive reflection work ahead of time. var peopleStruct = client.NewStruct(&Person{}) func main() { c, err := client.NewStargateClientWithConn(conn) if err != nil { log.Fatalf("error creating Stargate client: %v", err) } res, err := c.ExecuteQuery( &pb.Query{ Cql: "SELECT (id, name, age) FROM people", }, ) if err != nil { log.Fatalf("error executing query: %v", err) } // CURRENT APPROACH rows := res.GetResultSet().GetRows() ppl := make([]*Person, 0, len(rows)) for _, row := range rows { vals := row.GetValues() ppl = append(ppl, &Person{ ID: client.ToUUID(vals[0]), Name: client.ToString(vals[1]), Age: client.ToInt(vals[2]), }) } /// DESIRED APPROACH ppl, err := peopleStruct.Scan(res) // []*People, error if err != nil { log.Fatalf("error scanning results to dataset: %v", err) } }
https://github.com/huandu/go-sqlbuilder#using-struct-as-a-light-weight-orm https://gist.github.com/sosedoff/b373623a9572cf1a992486d2d87dcd85 https://stackoverflow.com/questions/10858787/what-are-the-uses-for-tags-in-go
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Overview
The only thing better than a Go gRPC API would be if you guys made it easy to get the data out of protos and into local structures.
How it might look
Helpful Links
https://github.com/huandu/go-sqlbuilder#using-struct-as-a-light-weight-orm
https://gist.github.com/sosedoff/b373623a9572cf1a992486d2d87dcd85
https://stackoverflow.com/questions/10858787/what-are-the-uses-for-tags-in-go
The text was updated successfully, but these errors were encountered: