This commit is contained in:
mr
2026-02-19 09:43:44 +01:00
parent 0b41e2505e
commit 9662ac6d67
7 changed files with 17 additions and 15 deletions

View File

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

View File

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