0x4a52466c696e74 1 week ago
parent
commit
a6b6132454
1 changed files with 5 additions and 0 deletions
  1. 5 0
      rest_gorm/request_list.go

+ 5 - 0
rest_gorm/request_list.go

@@ -128,6 +128,11 @@ func (s *List) ResultOut(pg *gorm.DB, model any, req rest.IRequestIn) rest.IRequ
 	if err != nil {
 		return req.OutError(rest.ErrorMessage("ErrFileds", err.Error()))
 	}
+	// preload
+	if pg, err = Preload(model, req.Fields(), pg); err != nil {
+		return req.OutError(rest.ErrorMessage("ErrPreload", err.Error()))
+	}
+
 	// Определяем тип элемента напрямую без использования reflect.ValueOf
 	elemType := reflect.TypeOf(model)
 	log.Println(elemType)