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

pull/35/head
Jim 6 years ago committed by GitHub
parent 0676ea51f1
commit bd5ddea6e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -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

@ -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),

Loading…
Cancel
Save