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

entgql: create field Map example #387

Merged
merged 4 commits into from
Oct 16, 2022
Merged

entgql: create field Map example #387

merged 4 commits into from
Oct 16, 2022

Conversation

giautm
Copy link
Collaborator

@giautm giautm commented Oct 5, 2022

No description provided.

Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
@giautm giautm changed the title entgql: create Map field entgql: create field Map example Oct 5, 2022
@giautm giautm requested a review from a8m October 5, 2022 05:48
@@ -53,11 +54,43 @@ func (r *queryResolver) Users(ctx context.Context, after *ent.Cursor, first *int
)
}

func (r *todoResolver) Init(ctx context.Context, obj *ent.Todo) (map[string]interface{}, error) {
Copy link
Member

@a8m a8m Oct 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add Map here to avoid these mappers:

models:
  ID:
    model:
      - github.com/99designs/gqlgen/graphql.IntID
  Uint64:
    model:
      - github.com/99designs/gqlgen/graphql.Uint64
+ Map:
+   model:
+     - github.com/99designs/gqlgen/graphql.Map

Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
Signed-off-by: Giau. Tran Minh <hello@giautm.dev>
@giautm giautm requested a review from a8m October 15, 2022 16:07
Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Great thing, @giautm.

@giautm giautm merged commit 5c27965 into master Oct 16, 2022
@giautm giautm deleted the g/map-example branch October 16, 2022 00:35
@giautm giautm restored the g/map-example branch March 30, 2023 22:12
@giautm giautm deleted the g/map-example branch April 4, 2023 10:43
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

Successfully merging this pull request may close these issues.

2 participants