This commit is contained in:
2025-04-06 13:13:56 +10:00
commit 2d4a82ca14
10 changed files with 1223 additions and 0 deletions

24
model/model.go Normal file
View File

@ -0,0 +1,24 @@
package model
import (
"go.mongodb.org/mongo-driver/v2/bson"
)
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 NewItems[T any](items []*T) []*Item[T] {
var result []*Item[T]
for _, item := range items {
result = append(result, NewItem(item))
}
return result
}