You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mongox-go-driver/mongox/common.go

39 lines
922 B

package mongox
import (
"go.mongodb.org/mongo-driver/bson/primitive"
)
6 years ago
// Saver is an interface for documents that can be saved
type Saver interface {
Save(db *Database) error
}
6 years ago
// Deleter is an interface for documents that can be deleted
type Deleter interface {
Delete(db *Database) error
}
6 years ago
// Loader is an interface for documents that can be loaded
type Loader interface {
Load(db *Database, filters ...interface{}) error
}
6 years ago
// BaseObjectID is an interface for documents that have objectId type for the _id field
type BaseObjectID interface {
GetID() primitive.ObjectID
SetID(id primitive.ObjectID)
}
6 years ago
6 years ago
// BaseString is an interface for documents that have string type for the _id field
6 years ago
type BaseString interface {
GetID() string
SetID(id string)
}
6 years ago
6 years ago
// BaseObject is an interface for documents that have object type for the _id field
6 years ago
type BaseObject interface {
GetID() primitive.D
SetID(id primitive.D)
}