refactor clonable to not rely on the resource interface (#36)

This commit is contained in:
Jim authored and GitHub committed 2020-05-11 10:31:15 -04:00
1 parent 0676ea51f1
commit bd5ddea6e4
3 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -105,7 +105,7 @@ type GormReadWriter struct {
Tx *gorm.DB
}
// ensure that GroupRole implements the interfaces of: Resource, ClonableResource, AssignedRole and db.VetForWriter
// ensure that GormReadWriter implements the interfaces of: Reader and Writer
var _ Reader = (*GormReadWriter)(nil)
var _ Writer = (*GormReadWriter)(nil)
+2 -2
View File
@@ -71,8 +71,8 @@ func (r ResourceType) String() string {
}[r]
}
type ClonableResource interface {
Clone() Resource
type Clonable interface {
Clone() interface{}
}
// ResourceWithScope defines an interface for Resources that have a scope
+2 -2
View File
@@ -40,7 +40,7 @@ type Scope struct {
// ensure that Scope implements the interfaces of: Resource, ClonableResource, and db.VetForWriter
var _ Resource = (*Scope)(nil)
var _ db.VetForWriter = (*Scope)(nil)
var _ ClonableResource = (*Scope)(nil)
var _ Clonable = (*Scope)(nil)
func NewOrganization(opt ...Option) (*Scope, error) {
return newScope(OrganizationScope, opt...)
@@ -114,7 +114,7 @@ func allocScope() Scope {
}
// Clone creates a clone of the Scope
func (s *Scope) Clone() Resource {
func (s *Scope) Clone() interface{} {
cp := proto.Clone(s.Scope)
return &Scope{
Scope: cp.(*store.Scope),