mirror of
https://github.com/bestnite/igdb-database.git
synced 2025-06-16 09:53:19 +08:00
u
This commit is contained in:
@ -2,7 +2,6 @@ package model
|
||||
|
||||
import (
|
||||
pb "github.com/bestnite/go-igdb/proto"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
@ -10,7 +9,6 @@ type GameIds []uint64
|
||||
type GameId uint64
|
||||
|
||||
type Game struct {
|
||||
MId bson.ObjectID `json:"_id,omitempty"`
|
||||
Id uint64 `json:"id,omitempty"`
|
||||
AgeRatings []*pb.AgeRating `json:"age_ratings,omitempty"`
|
||||
AggregatedRating float64 `json:"aggregated_rating,omitempty"`
|
||||
|
@ -1,24 +1,20 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
// type Item[T any] struct {
|
||||
// Item *T `bson:"item"`
|
||||
// MId bson.ObjectID `bson:"_id"`
|
||||
// }
|
||||
|
||||
type Item[T any] struct {
|
||||
Item *T `bson:"item"`
|
||||
MId bson.ObjectID `bson:"_id"`
|
||||
}
|
||||
// func NewItem[T any](item *T) *Item[T] {
|
||||
// return &Item[T]{
|
||||
// Item: item,
|
||||
// }
|
||||
// }
|
||||
|
||||
func NewItem[T any](item *T) *Item[T] {
|
||||
return &Item[T]{
|
||||
Item: item,
|
||||
}
|
||||
}
|
||||
|
||||
func NewItems[T any](items []*T) []*Item[T] {
|
||||
var result []*Item[T]
|
||||
for _, item := range items {
|
||||
result = append(result, NewItem(item))
|
||||
}
|
||||
return result
|
||||
}
|
||||
// func NewItems[T any](items []*T) []*Item[T] {
|
||||
// var result []*Item[T]
|
||||
// for _, item := range items {
|
||||
// result = append(result, NewItem(item))
|
||||
// }
|
||||
// return result
|
||||
// }
|
||||
|
Reference in New Issue
Block a user