Skip to content

Is there a way to change []*Thing to []Thing? #2613

Answered by a8m
frederikhors asked this question in Q&A
Discussion options

You must be logged in to vote

If you mean for an entity (eager-loaded) edges that are a few reasons for this, but the main 2 are: this is how Ent distinguishes between Found/NotFound (see example) and in some cases, we reuse the same object in a few references.

For gqlgen integration, we also return pointers to indicate null (not found) object. Here's an example: https://github.com/ent/contrib/blob/master/entgql/internal/todo/ent/gql_edge.go#L164

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by frederikhors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants