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