DBAbstract
This commit is contained in:
@@ -176,6 +176,10 @@ type AbstractAccessor[T DBObject] struct {
|
||||
NotImplemented []string
|
||||
}
|
||||
|
||||
func (r *AbstractAccessor[T]) NewObj() DBObject {
|
||||
return r.New()
|
||||
}
|
||||
|
||||
func (r *AbstractAccessor[T]) ShouldVerifyAuth() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func ModelGenericUpdateOne(change map[string]interface{}, id string, a Accessor)
|
||||
if err != nil {
|
||||
return nil, nil, c, err
|
||||
}
|
||||
obj := &AbstractObject{}
|
||||
obj := a.NewObj()
|
||||
b, _ := json.Marshal(r)
|
||||
json.Unmarshal(b, obj)
|
||||
ok, r := r.CanUpdate(obj)
|
||||
|
||||
@@ -40,6 +40,7 @@ type DBObject interface {
|
||||
|
||||
// Accessor is an interface that defines the basic methods for an Accessor
|
||||
type Accessor interface {
|
||||
NewObj() DBObject
|
||||
GetUser() string
|
||||
GetPeerID() string
|
||||
GetGroups() []string
|
||||
|
||||
Reference in New Issue
Block a user