You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Team (and TeamID in Golang struct) is NOT mandatory, so I'm using a pointer type (*)
What I don't understand now is how to use dataloaden (a GraphQL dataloader).
Here the generated code for CityById loader, generated with: go run github.com/vektah/dataloaden CityByIdLoader int *my_project/entities.City:
CityById: CityByIdLoader{
maxBatch: 100,
wait: 1*time.Millisecond,
fetch: func(keys []int) ([]*entities.City, []error) {
cities, err:=myRepo.CitiesByKeys(keys)
// directly ordered in DB based on keys` order: it worksreturncities, []error{err}
},
},
What about []*int for TeamID?
Here's the generated code for TeamById loader, generated with: go run github.com/vektah/dataloaden TeamByIdLoader *int *my_project/entities.Team:
TeamById: TeamByIdLoader{
maxBatch: 100,
wait: 1*time.Millisecond,
fetch: func(keys []int) ([]*entities.Team, []error) {
teams, err:=myRepo.TeamsByKeys(keys)
// I cannot order in DB because of `NULL` keys, right?// How to order these results?returnteams, []error{err}
},
},
I don't understand how to re-order teams by keys if I cannot do it in DB because of NULL values in keys.
The text was updated successfully, but these errors were encountered:
I have these entities:
As you can see:
City
is mandatoryTeam
(andTeamID
in Golang struct) is NOT mandatory, so I'm using a pointer type (*
)What I don't understand now is how to use
dataloaden
(a GraphQL dataloader).Here the generated code for
CityById
loader, generated with:go run github.com/vektah/dataloaden CityByIdLoader int *my_project/entities.City
:What about
[]*int
forTeamID
?Here's the generated code for
TeamById
loader, generated with:go run github.com/vektah/dataloaden TeamByIdLoader *int *my_project/entities.Team
:I don't understand how to re-order teams by keys if I cannot do it in DB because of
NULL
values inkeys
.The text was updated successfully, but these errors were encountered: