mirror of
https://github.com/bestnite/igdb-database.git
synced 2025-06-02 19:45:01 +08:00
u
This commit is contained in:
parent
ea4d01c9a6
commit
577a17bac7
@ -26,74 +26,74 @@ func StartWebhookServer(client *igdb.Client) {
|
||||
log.Fatalf("failed to parse url: %v", err)
|
||||
}
|
||||
|
||||
http.HandleFunc(webhook(client.AgeRatingCategories))
|
||||
http.HandleFunc(webhook(client.AgeRatingContentDescriptions))
|
||||
http.HandleFunc(webhook(client.AgeRatingContentDescriptionsV2))
|
||||
http.HandleFunc(webhook(client.AgeRatingOrganizations))
|
||||
http.HandleFunc(webhook(client.AgeRatings))
|
||||
http.HandleFunc(webhook(client.AlternativeNames))
|
||||
http.HandleFunc(webhook(client.Artworks))
|
||||
http.HandleFunc(webhook(client.CharacterGenders))
|
||||
http.HandleFunc(webhook(client.CharacterMugShots))
|
||||
http.HandleFunc(webhook(client.Characters))
|
||||
http.HandleFunc(webhook(client.CharacterSpecies))
|
||||
http.HandleFunc(webhook(client.CollectionMemberships))
|
||||
http.HandleFunc(webhook(client.CollectionMembershipTypes))
|
||||
http.HandleFunc(webhook(client.CollectionRelations))
|
||||
http.HandleFunc(webhook(client.CollectionRelationTypes))
|
||||
http.HandleFunc(webhook(client.Collections))
|
||||
http.HandleFunc(webhook(client.CollectionTypes))
|
||||
http.HandleFunc(webhook(client.Companies))
|
||||
http.HandleFunc(webhook(client.CompanyLogos))
|
||||
http.HandleFunc(webhook(client.CompanyStatuses))
|
||||
http.HandleFunc(webhook(client.CompanyWebsites))
|
||||
http.HandleFunc(webhook(client.Covers))
|
||||
http.HandleFunc(webhook(client.DateFormats))
|
||||
http.HandleFunc(webhook(client.EventLogos))
|
||||
http.HandleFunc(webhook(client.EventNetworks))
|
||||
http.HandleFunc(webhook(client.Events))
|
||||
http.HandleFunc(webhook(client.ExternalGames))
|
||||
http.HandleFunc(webhook(client.ExternalGameSources))
|
||||
http.HandleFunc(webhook(client.Franchises))
|
||||
http.HandleFunc(webhook(client.GameEngineLogos))
|
||||
http.HandleFunc(webhook(client.GameEngines))
|
||||
http.HandleFunc(webhook(client.GameLocalizations))
|
||||
http.HandleFunc(webhook(client.GameModes))
|
||||
http.HandleFunc(webhook(client.GameReleaseFormats))
|
||||
http.HandleFunc(webhook(client.Games))
|
||||
http.HandleFunc(webhook(client.GameStatuses))
|
||||
http.HandleFunc(webhook(client.GameTimeToBeats))
|
||||
http.HandleFunc(webhook(client.GameTypes))
|
||||
http.HandleFunc(webhook(client.GameVersionFeatures))
|
||||
http.HandleFunc(webhook(client.GameVersionFeatureValues))
|
||||
http.HandleFunc(webhook(client.GameVersions))
|
||||
http.HandleFunc(webhook(client.GameVideos))
|
||||
http.HandleFunc(webhook(client.Genres))
|
||||
http.HandleFunc(webhook(client.InvolvedCompanies))
|
||||
http.HandleFunc(webhook(client.Keywords))
|
||||
http.HandleFunc(webhook(client.Languages))
|
||||
http.HandleFunc(webhook(client.LanguageSupports))
|
||||
http.HandleFunc(webhook(client.LanguageSupportTypes))
|
||||
http.HandleFunc(webhook(client.MultiplayerModes))
|
||||
http.HandleFunc(webhook(client.NetworkTypes))
|
||||
http.HandleFunc(webhook(client.PlatformFamilies))
|
||||
http.HandleFunc(webhook(client.PlatformLogos))
|
||||
http.HandleFunc(webhook(client.Platforms))
|
||||
http.HandleFunc(webhook(client.PlatformTypes))
|
||||
http.HandleFunc(webhook(client.PlatformVersionCompanies))
|
||||
http.HandleFunc(webhook(client.PlatformVersionReleaseDates))
|
||||
http.HandleFunc(webhook(client.PlatformVersions))
|
||||
http.HandleFunc(webhook(client.PlatformWebsites))
|
||||
http.HandleFunc(webhook(client.PlayerPerspectives))
|
||||
http.HandleFunc(webhook(client.PopularityTypes))
|
||||
http.HandleFunc(webhook(client.Regions))
|
||||
http.HandleFunc(webhook(client.ReleaseDateRegions))
|
||||
http.HandleFunc(webhook(client.ReleaseDates))
|
||||
http.HandleFunc(webhook(client.ReleaseDateStatuses))
|
||||
http.HandleFunc(webhook(client.Screenshots))
|
||||
http.HandleFunc(webhook(client.Themes))
|
||||
http.HandleFunc(webhook(client.Websites))
|
||||
http.HandleFunc(webhook(client.WebsiteTypes))
|
||||
http.HandleFunc(webhook(client.AgeRatingCategories, client))
|
||||
http.HandleFunc(webhook(client.AgeRatingContentDescriptions, client))
|
||||
http.HandleFunc(webhook(client.AgeRatingContentDescriptionsV2, client))
|
||||
http.HandleFunc(webhook(client.AgeRatingOrganizations, client))
|
||||
http.HandleFunc(webhook(client.AgeRatings, client))
|
||||
http.HandleFunc(webhook(client.AlternativeNames, client))
|
||||
http.HandleFunc(webhook(client.Artworks, client))
|
||||
http.HandleFunc(webhook(client.CharacterGenders, client))
|
||||
http.HandleFunc(webhook(client.CharacterMugShots, client))
|
||||
http.HandleFunc(webhook(client.Characters, client))
|
||||
http.HandleFunc(webhook(client.CharacterSpecies, client))
|
||||
http.HandleFunc(webhook(client.CollectionMemberships, client))
|
||||
http.HandleFunc(webhook(client.CollectionMembershipTypes, client))
|
||||
http.HandleFunc(webhook(client.CollectionRelations, client))
|
||||
http.HandleFunc(webhook(client.CollectionRelationTypes, client))
|
||||
http.HandleFunc(webhook(client.Collections, client))
|
||||
http.HandleFunc(webhook(client.CollectionTypes, client))
|
||||
http.HandleFunc(webhook(client.Companies, client))
|
||||
http.HandleFunc(webhook(client.CompanyLogos, client))
|
||||
http.HandleFunc(webhook(client.CompanyStatuses, client))
|
||||
http.HandleFunc(webhook(client.CompanyWebsites, client))
|
||||
http.HandleFunc(webhook(client.Covers, client))
|
||||
http.HandleFunc(webhook(client.DateFormats, client))
|
||||
http.HandleFunc(webhook(client.EventLogos, client))
|
||||
http.HandleFunc(webhook(client.EventNetworks, client))
|
||||
http.HandleFunc(webhook(client.Events, client))
|
||||
http.HandleFunc(webhook(client.ExternalGames, client))
|
||||
http.HandleFunc(webhook(client.ExternalGameSources, client))
|
||||
http.HandleFunc(webhook(client.Franchises, client))
|
||||
http.HandleFunc(webhook(client.GameEngineLogos, client))
|
||||
http.HandleFunc(webhook(client.GameEngines, client))
|
||||
http.HandleFunc(webhook(client.GameLocalizations, client))
|
||||
http.HandleFunc(webhook(client.GameModes, client))
|
||||
http.HandleFunc(webhook(client.GameReleaseFormats, client))
|
||||
http.HandleFunc(webhook(client.Games, client))
|
||||
http.HandleFunc(webhook(client.GameStatuses, client))
|
||||
http.HandleFunc(webhook(client.GameTimeToBeats, client))
|
||||
http.HandleFunc(webhook(client.GameTypes, client))
|
||||
http.HandleFunc(webhook(client.GameVersionFeatures, client))
|
||||
http.HandleFunc(webhook(client.GameVersionFeatureValues, client))
|
||||
http.HandleFunc(webhook(client.GameVersions, client))
|
||||
http.HandleFunc(webhook(client.GameVideos, client))
|
||||
http.HandleFunc(webhook(client.Genres, client))
|
||||
http.HandleFunc(webhook(client.InvolvedCompanies, client))
|
||||
http.HandleFunc(webhook(client.Keywords, client))
|
||||
http.HandleFunc(webhook(client.Languages, client))
|
||||
http.HandleFunc(webhook(client.LanguageSupports, client))
|
||||
http.HandleFunc(webhook(client.LanguageSupportTypes, client))
|
||||
http.HandleFunc(webhook(client.MultiplayerModes, client))
|
||||
http.HandleFunc(webhook(client.NetworkTypes, client))
|
||||
http.HandleFunc(webhook(client.PlatformFamilies, client))
|
||||
http.HandleFunc(webhook(client.PlatformLogos, client))
|
||||
http.HandleFunc(webhook(client.Platforms, client))
|
||||
http.HandleFunc(webhook(client.PlatformTypes, client))
|
||||
http.HandleFunc(webhook(client.PlatformVersionCompanies, client))
|
||||
http.HandleFunc(webhook(client.PlatformVersionReleaseDates, client))
|
||||
http.HandleFunc(webhook(client.PlatformVersions, client))
|
||||
http.HandleFunc(webhook(client.PlatformWebsites, client))
|
||||
http.HandleFunc(webhook(client.PlayerPerspectives, client))
|
||||
http.HandleFunc(webhook(client.PopularityTypes, client))
|
||||
http.HandleFunc(webhook(client.Regions, client))
|
||||
http.HandleFunc(webhook(client.ReleaseDateRegions, client))
|
||||
http.HandleFunc(webhook(client.ReleaseDates, client))
|
||||
http.HandleFunc(webhook(client.ReleaseDateStatuses, client))
|
||||
http.HandleFunc(webhook(client.Screenshots, client))
|
||||
http.HandleFunc(webhook(client.Themes, client))
|
||||
http.HandleFunc(webhook(client.Websites, client))
|
||||
http.HandleFunc(webhook(client.WebsiteTypes, client))
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(200)
|
||||
if _, err := w.Write([]byte("Hello World!")); err != nil {
|
||||
@ -141,6 +141,7 @@ func StartWebhookServer(client *igdb.Client) {
|
||||
|
||||
func webhook[T any](
|
||||
e endpoint.EntityEndpoint[T],
|
||||
client *igdb.Client,
|
||||
) (string, func(w http.ResponseWriter, r *http.Request)) {
|
||||
return fmt.Sprintf("/webhook/%s", e.GetEndpointName()), func(w http.ResponseWriter, r *http.Request) {
|
||||
secret := r.Header.Get("X-Secret")
|
||||
@ -173,7 +174,7 @@ func webhook[T any](
|
||||
|
||||
if _, ok := any(e).(*endpoint.Games); ok {
|
||||
game := any(item).(*pb.Game)
|
||||
g, err := db.ConvertGame(game)
|
||||
g, err := db.ConvertGame(game, client)
|
||||
if err != nil {
|
||||
log.Printf("failed to convert game: %v", err)
|
||||
} else {
|
||||
@ -199,7 +200,7 @@ func webhook[T any](
|
||||
log.Printf("failed to get game: %v", err)
|
||||
goto END
|
||||
}
|
||||
g, err := db.ConvertGame(game)
|
||||
g, err := db.ConvertGame(game, client)
|
||||
if err != nil {
|
||||
log.Printf("failed to convert game: %v", err)
|
||||
goto END
|
||||
|
30
db/db.go
30
db/db.go
@ -125,6 +125,14 @@ func (m *MongoDB) createIndex() {
|
||||
if err != nil {
|
||||
log.Printf("failed to create index id for %s: %v", string(e), err)
|
||||
}
|
||||
_, err = m.Collections[e].Indexes().CreateOne(ctx, mongo.IndexModel{
|
||||
Keys: bson.D{
|
||||
{Key: "updated_at", Value: 1},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("failed to create index id for %s: %v", string(e), err)
|
||||
}
|
||||
}
|
||||
|
||||
_, err := m.GameCollection.Indexes().CreateOne(ctx, mongo.IndexModel{
|
||||
@ -276,3 +284,25 @@ func GetItemsPaginated[T any](e endpoint.Name, skip int64, limit int64) ([]*T, e
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func GetItemsSorted[T any](e endpoint.Name, limit int, sort bson.M) ([]*T, error) {
|
||||
coll := GetInstance().Collections[e]
|
||||
if coll == nil {
|
||||
return nil, fmt.Errorf("collection not found")
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second+time.Duration(limit*200)*time.Millisecond)
|
||||
defer cancel()
|
||||
opts := options.Find().SetLimit(int64(limit)).SetSort(sort)
|
||||
cursor, err := coll.Find(ctx, bson.M{}, opts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get items: %w", err)
|
||||
}
|
||||
|
||||
var items []*T
|
||||
err = cursor.All(ctx, &items)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get items: %w", err)
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
14
db/game.go
14
db/game.go
@ -7,6 +7,7 @@ import (
|
||||
"igdb-database/model"
|
||||
"time"
|
||||
|
||||
"github.com/bestnite/go-igdb"
|
||||
"github.com/bestnite/go-igdb/endpoint"
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
@ -69,7 +70,7 @@ func SaveGames(games []*model.Game) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ConvertGame(game *pb.Game) (*model.Game, error) {
|
||||
func ConvertGame(game *pb.Game, client *igdb.Client) (*model.Game, error) {
|
||||
res := &model.Game{}
|
||||
|
||||
if game == nil {
|
||||
@ -120,8 +121,15 @@ func ConvertGame(game *pb.Game) (*model.Game, error) {
|
||||
if game.Cover != nil {
|
||||
coverId := game.Cover.Id
|
||||
cover, err := GetItemById[pb.Cover](endpoint.EPCovers, coverId)
|
||||
if err != nil && !errors.Is(err, mongo.ErrNoDocuments) {
|
||||
return nil, err
|
||||
if err != nil {
|
||||
if errors.Is(err, mongo.ErrNoDocuments) {
|
||||
cover, err = client.Covers.GetByID(coverId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if cover != nil {
|
||||
res.Cover = cover
|
||||
|
18
go.mod
18
go.mod
@ -3,7 +3,7 @@ module igdb-database
|
||||
go 1.24.1
|
||||
|
||||
require (
|
||||
github.com/bestnite/go-igdb v0.0.12
|
||||
github.com/bestnite/go-igdb v0.0.13
|
||||
go.mongodb.org/mongo-driver/v2 v2.1.0
|
||||
google.golang.org/protobuf v1.36.6
|
||||
)
|
||||
@ -11,24 +11,24 @@ require (
|
||||
require (
|
||||
github.com/Danny-Dasilva/CycleTLS/cycletls v1.0.26 // indirect
|
||||
github.com/Danny-Dasilva/fhttp v0.0.0-20240217042913-eeeb0b347ce1 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.10.2 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.10.3 // indirect
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||
github.com/bestnite/go-flaresolverr v0.0.0-20250404141941-4644c2e66727 // indirect
|
||||
github.com/cloudflare/circl v1.6.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.1 // indirect
|
||||
github.com/go-resty/resty/v2 v2.16.5 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/refraction-networking/utls v1.6.7 // indirect
|
||||
github.com/refraction-networking/utls v1.7.3 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||
golang.org/x/crypto v0.37.0 // indirect
|
||||
golang.org/x/net v0.39.0 // indirect
|
||||
golang.org/x/sync v0.13.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/text v0.24.0 // indirect
|
||||
golang.org/x/crypto v0.38.0 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sync v0.14.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
h12.io/socks v1.0.3 // indirect
|
||||
)
|
||||
|
40
go.sum
40
go.sum
@ -12,8 +12,8 @@ github.com/Danny-Dasilva/CycleTLS/cycletls v1.0.26 h1:6fexoGmvzoXMSk14BZ0AirapVm
|
||||
github.com/Danny-Dasilva/CycleTLS/cycletls v1.0.26/go.mod h1:QFi/EVO7qqru3Ftxz1LR+96jIc91Tifv0DnskF/gWQ8=
|
||||
github.com/Danny-Dasilva/fhttp v0.0.0-20240217042913-eeeb0b347ce1 h1:/lqhaiz7xdPr6kuaW1tQ/8DdpWdxkdyd9W/6EHz4oRw=
|
||||
github.com/Danny-Dasilva/fhttp v0.0.0-20240217042913-eeeb0b347ce1/go.mod h1:Hvab/V/YKCDXsEpKYKHjAXH5IFOmoq9FsfxjztEqvDc=
|
||||
github.com/PuerkitoBio/goquery v1.10.2 h1:7fh2BdHcG6VFZsK7toXBT/Bh1z5Wmy8Q9MV9HqT2AM8=
|
||||
github.com/PuerkitoBio/goquery v1.10.2/go.mod h1:0guWGjcLu9AYC7C1GHnpysHy056u9aEkUHwhdnePMCU=
|
||||
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
|
||||
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
|
||||
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
@ -23,10 +23,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/bestnite/go-flaresolverr v0.0.0-20250404141941-4644c2e66727 h1:F1fNb9j7wgPXa54SWAIYn1l8NJTg74Qx3EJ8qmys6FY=
|
||||
github.com/bestnite/go-flaresolverr v0.0.0-20250404141941-4644c2e66727/go.mod h1:LX2oPIfG4LnUtQ7FAWV727IXuODZVbzRwG/7t2KdMNo=
|
||||
github.com/bestnite/go-igdb v0.0.11 h1:DIG3NjTpRfpIDIbTsbOuMWI/Y7IZRUNu/WaOaPZdcKg=
|
||||
github.com/bestnite/go-igdb v0.0.11/go.mod h1:HBPwYCgSVd7oaiLWJVV72UpqsmIYjUmaIvGmuFk3CwY=
|
||||
github.com/bestnite/go-igdb v0.0.12 h1:zWTcJTYeV/j5vlNXoyadnOEsOJQfYIh+iLq1FurN0G4=
|
||||
github.com/bestnite/go-igdb v0.0.12/go.mod h1:HBPwYCgSVd7oaiLWJVV72UpqsmIYjUmaIvGmuFk3CwY=
|
||||
github.com/bestnite/go-igdb v0.0.13 h1:4E1q1zK+wbcPs0LOrVlJmIIjW4+gLvqDvUxcF95lKJ4=
|
||||
github.com/bestnite/go-igdb v0.0.13/go.mod h1:HBPwYCgSVd7oaiLWJVV72UpqsmIYjUmaIvGmuFk3CwY=
|
||||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
|
||||
@ -35,8 +33,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
|
||||
github.com/cloudflare/circl v1.6.0 h1:cr5JKic4HI+LkINy2lg3W2jF8sHCVTBncJr5gIIq7qk=
|
||||
github.com/cloudflare/circl v1.6.0/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
|
||||
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||
github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@ -165,8 +163,8 @@ github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1
|
||||
github.com/quic-go/qtls-go1-20 v0.3.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
|
||||
github.com/quic-go/quic-go v0.37.4/go.mod h1:YsbH1r4mSHPJcLF4k4zruUkLBqctEMBDR6VPvcYjIsU=
|
||||
github.com/refraction-networking/utls v1.5.4/go.mod h1:SPuDbBmgLGp8s+HLNc83FuavwZCFoMmExj+ltUHiHUw=
|
||||
github.com/refraction-networking/utls v1.6.7 h1:zVJ7sP1dJx/WtVuITug3qYUq034cDq9B2MR1K67ULZM=
|
||||
github.com/refraction-networking/utls v1.6.7/go.mod h1:BC3O4vQzye5hqpmDTWUqi4P5DDhzJfkV1tdqtawQIH0=
|
||||
github.com/refraction-networking/utls v1.7.3 h1:L0WRhHY7Oq1T0zkdzVZMR6zWZv+sXbHB9zcuvsAEqCo=
|
||||
github.com/refraction-networking/utls v1.7.3/go.mod h1:TUhh27RHMGtQvjQq+RyO11P6ZNQNBb3N0v7wsEjKAIQ=
|
||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
|
||||
@ -233,8 +231,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
|
||||
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
|
||||
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@ -284,10 +282,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
|
||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
|
||||
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
@ -307,8 +303,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
|
||||
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -345,8 +341,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
|
||||
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@ -379,8 +375,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
|
||||
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
|
||||
|
6
main.go
6
main.go
@ -36,7 +36,7 @@ func main() {
|
||||
|
||||
if *enableAggregate || *enableReAggregate {
|
||||
log.Printf("aggregating games")
|
||||
aggregateGames()
|
||||
aggregateGames(client)
|
||||
log.Printf("games aggregated")
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func aggregateGames() {
|
||||
func aggregateGames(client *igdb.Client) {
|
||||
total, err := db.EstimatedDocumentCount(endpoint.EPGames)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to count games: %v", err)
|
||||
@ -89,7 +89,7 @@ func aggregateGames() {
|
||||
continue
|
||||
}
|
||||
|
||||
game, err := db.ConvertGame(item)
|
||||
game, err := db.ConvertGame(item, client)
|
||||
if err != nil {
|
||||
log.Fatalf("failed to convert game: %v", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user