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

[feature] - resolve complex field in type #88

Closed
imiskolee opened this issue Apr 19, 2018 · 1 comment
Closed

[feature] - resolve complex field in type #88

imiskolee opened this issue Apr 19, 2018 · 1 comment

Comments

@imiskolee
Copy link

type FieldA {
   id : Int!
   name: String!
}

type ComplexField {
    Items:[FieldA]
}

will be parse to

type ComplexField struct {
	ItemsID int
}
type FieldA struct {
	ID   int
	Name string
}

if FieldA is related to another model,its fine. but its not good when FieldA just is a Field of ComplexField(In Mysql 5.7 support JSON data type), i want we has a way to generate it to

type ComplexField struct {
	Items []FieldA
}

type FieldA struct {
	ID   int
	Name string
}
@vektah
Copy link
Collaborator

vektah commented Apr 19, 2018

There was a little bit of chatter around this in #80 and #78

I think the current approach is to hand roll your database models (or generate them and copy them out, or use a ORM that generates models for you) and bind to them in types.json. There are going to be too many edge cases to cater for everyone.

@vektah vektah closed this as completed May 3, 2018
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

2 participants