Compare commits
No commits in common. "5624a0760756ce4ca21df7005fb7543d704c5ab3" and "30a8065a464675c593ef90ecacdefe6a6a3181ce" have entirely different histories.
5624a07607
...
30a8065a46
@ -40,20 +40,6 @@ type CardSupply struct {
|
|||||||
Unique int `graphql:"unique"`
|
Unique int `graphql:"unique"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MembershipStats struct {
|
|
||||||
Season struct {
|
|
||||||
StartYear int `graphql:"startYear"`
|
|
||||||
} `graphql:"season"`
|
|
||||||
Appearances int `graphql:"appearances"`
|
|
||||||
Goals int `graphql:"goals"`
|
|
||||||
Assists int `graphql:"assists"`
|
|
||||||
YellowCards int `graphql:"yellowCards"`
|
|
||||||
RedCards int `graphql:"redCards"`
|
|
||||||
MinutesPlayed int `graphql:"minutesPlayed"`
|
|
||||||
SubstituteIn int `graphql:"substituteIn"`
|
|
||||||
SubstituteOut int `graphql:"substituteOut"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Membership struct {
|
type Membership struct {
|
||||||
Id graphql.Id `graphql:"id"`
|
Id graphql.Id `graphql:"id"`
|
||||||
StartDate time.Time `graphql:"startDate"`
|
StartDate time.Time `graphql:"startDate"`
|
||||||
@ -67,7 +53,6 @@ type Membership struct {
|
|||||||
Slug string `graphql:"slug"`
|
Slug string `graphql:"slug"`
|
||||||
} `graphql:"... on NationalTeam"`
|
} `graphql:"... on NationalTeam"`
|
||||||
} `graphql:"membershipTeam"`
|
} `graphql:"membershipTeam"`
|
||||||
Stats []MembershipStats `graphql:"stats"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Player struct {
|
type Player struct {
|
||||||
|
@ -3,6 +3,8 @@ package graphql
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PaginatedQuery[ResultType any, Params any] struct {
|
type PaginatedQuery[ResultType any, Params any] struct {
|
||||||
@ -69,6 +71,7 @@ func (pq *PaginatedQuery[ResultType, Params]) Get(
|
|||||||
after := ""
|
after := ""
|
||||||
var noop ResultType
|
var noop ResultType
|
||||||
pageSize := (pq.c.MaxComplexity() - 9) / (GetComplexity(reflect.TypeOf(noop)) + 1)
|
pageSize := (pq.c.MaxComplexity() - 9) / (GetComplexity(reflect.TypeOf(noop)) + 1)
|
||||||
|
log.Debug().Msgf("using page size %d", pageSize)
|
||||||
for {
|
for {
|
||||||
page, pi, err := pq.getPage(ctx, params, after, pageSize)
|
page, pi, err := pq.getPage(ctx, params, after, pageSize)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user