|
@@ -115,7 +115,16 @@ func (s *List) ResultAnswer(pg *gorm.DB, fields rest.FieldNamesList, res any, of
|
|
return rList, nil
|
|
return rList, nil
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *List) ResultOut(pg *gorm.DB, fields rest.FieldNamesList, res any, req rest.IRequestIn) rest.IRequestOut {
|
|
|
|
|
|
+func (s *List) ResultOut(pg *gorm.DB, model any, req rest.IRequestIn) rest.IRequestOut {
|
|
|
|
+ fieldNames, err := rest.FieldNames(model)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return req.OutError(rest.ErrorMessage("ErrFileds", err.Error()))
|
|
|
|
+ }
|
|
|
|
+ sl := reflect.MakeSlice(reflect.ValueOf(model).Type(), 0, 0).Interface()
|
|
|
|
+ return s.ResultOutNames(pg, fieldNames, sl, req)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func (s *List) ResultOutNames(pg *gorm.DB, fields rest.FieldNamesList, res any, req rest.IRequestIn) rest.IRequestOut {
|
|
rList, err := s.ResultAnswer(pg, fields, res, s.Offset, s.Limit)
|
|
rList, err := s.ResultAnswer(pg, fields, res, s.Offset, s.Limit)
|
|
if err != nil {
|
|
if err != nil {
|
|
return req.OutError(err)
|
|
return req.OutError(err)
|