fixed doc env vars + mongo v2 migration
This commit is contained in:
@@ -3,7 +3,7 @@ package storable
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -15,16 +15,16 @@ const (
|
||||
)
|
||||
|
||||
type Base struct {
|
||||
ID primitive.ObjectID `bson:"_id" json:"id"`
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // Timestamp for when the comment was created
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // Timestamp for when the comment was last updated (optional)
|
||||
ID bson.ObjectID `bson:"_id" json:"id"`
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // Timestamp for when the comment was created
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // Timestamp for when the comment was last updated (optional)
|
||||
}
|
||||
|
||||
func (b *Base) GetID() *primitive.ObjectID {
|
||||
func (b *Base) GetID() *bson.ObjectID {
|
||||
return &b.ID
|
||||
}
|
||||
|
||||
func (b *Base) SetID(objID primitive.ObjectID) {
|
||||
func (b *Base) SetID(objID bson.ObjectID) {
|
||||
b.ID = objID
|
||||
b.CreatedAt = time.Now()
|
||||
b.UpdatedAt = time.Now()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package storable
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
import "go.mongodb.org/mongo-driver/v2/bson"
|
||||
|
||||
const (
|
||||
RefField = "ref"
|
||||
)
|
||||
|
||||
type Ref struct {
|
||||
Ref primitive.ObjectID `bson:"ref" json:"ref"`
|
||||
Ref bson.ObjectID `bson:"ref" json:"ref"`
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package storable
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
import "go.mongodb.org/mongo-driver/v2/bson"
|
||||
|
||||
type Storable interface {
|
||||
GetID() *primitive.ObjectID
|
||||
SetID(objID primitive.ObjectID)
|
||||
GetID() *bson.ObjectID
|
||||
SetID(objID bson.ObjectID)
|
||||
Update()
|
||||
Collection() string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user