23 lines
350 B
Go
23 lines
350 B
Go
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
|
|
}
|