Skip to content
New issue

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

Cannot unmarshal into anonymous structs #11

Open
Mumakil opened this issue Jan 28, 2016 · 0 comments
Open

Cannot unmarshal into anonymous structs #11

Mumakil opened this issue Jan 28, 2016 · 0 comments

Comments

@Mumakil
Copy link

Mumakil commented Jan 28, 2016

It seems that cqlr cannot unmarshal Cassandra results into structs with anonymous fields:

type Type1 struct {
  ID *string `cql:"id"`
  Name *string `cql:"name"`
}

type Type2 struct {
  *Type1
  Description *string `cql:"description"`
}

and then using those:

q := fmt.Sprintf(`SELECT id,name,description FROM %s WHERE id=?`, store.table)
query := store.connection.Session.Query(q, uuid)
b := cqlr.BindQuery(query)
res := &Type2{}
for b.Scan(res) {
  // res.Type1.* are all nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant