tongo/item.go

23 lines
350 B
Go
Raw Normal View History

2023-01-20 01:40:55 +03:00
package tongo
import "go.mongodb.org/mongo-driver/bson/primitive"
type Collectable interface {
Coll() string
GetID() primitive.ObjectID
}
type Item struct {
Id primitive.ObjectID `bson:"_id" json:"Id,omitempty"`
}
func NewID() Item {
return Item{
Id: primitive.NewObjectID(),
}
}
func (i Item) GetID() primitive.ObjectID {
return i.Id
}