|
@@ -115,6 +115,14 @@ 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 {
|
|
|
|
+ rList, err := s.ResultAnswer(pg, fields, res, s.Offset, s.Limit)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return req.OutError(err)
|
|
|
|
+ }
|
|
|
|
+ return rList.Out(req)
|
|
|
|
+}
|
|
|
|
+
|
|
type ResultList struct {
|
|
type ResultList struct {
|
|
Items []any `json:"Items" rest:"fixed"`
|
|
Items []any `json:"Items" rest:"fixed"`
|
|
Offset int `json:"Offset" rest:"fixed"`
|
|
Offset int `json:"Offset" rest:"fixed"`
|
|
@@ -140,3 +148,11 @@ func (s *ResultList) Map(req rest.IRequestIn) (json.Map, rest.IErrorArgs) {
|
|
}
|
|
}
|
|
return res, nil
|
|
return res, nil
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+func (s *ResultList) Out(req rest.IRequestIn) rest.IRequestOut {
|
|
|
|
+ m, ierr := s.Map(req)
|
|
|
|
+ if ierr != nil {
|
|
|
|
+ return req.OutError(ierr)
|
|
|
|
+ }
|
|
|
|
+ return req.OutSuccess(m, nil)
|
|
|
|
+}
|