Files
sxchnge/backend/pkg/model/scopedstorablemodel.go
T

20 lines
710 B
Go

package model
import "go.mongodb.org/mongo-driver/v2/bson"
// ScopedStorable is the type constraint for resources that follow the
// personal-vs-org dual-ownership model. ScopedDBImp[T] provides generic
// CRUD and bulk operations for any T satisfying this interface without
// the permissionRef==NilObjectID sentinel pattern that ProtectedDBImp requires
// for personal-owned resources.
//
// Resources that embed model.PermissionBound and model.Owner satisfy
// ScopedStorable automatically once SetOwnerKind/SetOwnerRef methods are added.
type ScopedStorable interface {
OwnerBound
SetOwnerKind(OwnerKind)
SetOwnerRef(bson.ObjectID)
GetPermissionRef() bson.ObjectID
SetPermissionRef(bson.ObjectID)
}