Add New
This commit is contained in:
@@ -250,7 +250,7 @@ func (a *AbstractAccessor[T]) CopyOne(data DBObject) (DBObject, int, error) {
|
||||
}
|
||||
|
||||
func (a *AbstractAccessor[T]) LoadOne(id string) (DBObject, int, error) {
|
||||
return GenericLoadOne[T](id, func(d DBObject) (DBObject, int, error) {
|
||||
return GenericLoadOne[T](id, a.New(), func(d DBObject) (DBObject, int, error) {
|
||||
return d, 200, nil
|
||||
}, a)
|
||||
}
|
||||
|
||||
@@ -120,8 +120,7 @@ func GenericUpdateOne(set DBObject, id string, a Accessor, new DBObject) (DBObje
|
||||
return a.LoadOne(id)
|
||||
}
|
||||
|
||||
func GenericLoadOne[T DBObject](id string, f func(DBObject) (DBObject, int, error), a Accessor) (DBObject, int, error) {
|
||||
var data T
|
||||
func GenericLoadOne[T DBObject](id string, data T, f func(DBObject) (DBObject, int, error), a Accessor) (DBObject, int, error) {
|
||||
res_mongo, code, err := mongo.MONGOService.LoadOne(id, a.GetType().String())
|
||||
if err != nil {
|
||||
return nil, code, err
|
||||
|
||||
Reference in New Issue
Block a user