Compare commits
2 Commits
30a8065a46
...
5624a07607
Author | SHA1 | Date | |
---|---|---|---|
5624a07607 | |||
c693dd2017 |
@ -40,6 +40,20 @@ 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"`
|
||||||
@ -53,6 +67,7 @@ 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,8 +3,6 @@ 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 {
|
||||||
@ -71,7 +69,6 @@ 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