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

support populate slice of struct pointer. #48

Open
darasion opened this issue Sep 18, 2017 · 3 comments
Open

support populate slice of struct pointer. #48

darasion opened this issue Sep 18, 2017 · 3 comments

Comments

@darasion
Copy link

My code is like this:

var rows []*Row
db.Select().All(&rows)

and i got an error:
Invalid variable type: must be a slice of struct or NullStringMap

But a lot of scenarios use slice of pointers to structs, such as the codes generated by protocol buffer:

type FooRequest struct {
   // ...
    Rules  []*RuleFile `protobuf:"bytes,2,rep,name=rules" json:"rules,omitempty"`  // <-- this field
   // ...
}

We need to support populate slice of struct pointer so we can pass proto message field directly without convertion.

@kPshi
Copy link

kPshi commented Sep 28, 2017

I'm currently not on the console but I'm quite sure pull request #43 (fix for issue #42) should solve this.
Maybe you want to give it a try and push it a bit. ;-)

@kPshi
Copy link

kPshi commented Oct 13, 2017

Have you tried with

import "github.com/kPshi/ozzo-dbx"

in the meantime? That's a (currently still unmerged) fork which should fix that issue.
Please give PR #43 a thumbs up if so. Would like to return to the main branch soon.

@ganigeorgiev
Copy link

ganigeorgiev commented Jan 27, 2022

Because @kPshi's PR adds other things (and frankly I had trouble understanding what actually was happening), I've created a smaller PR that only adds the support for scanning slice of pointers - #99

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

3 participants