Skip to content

Commit

Permalink
convet int in relational crud service
Browse files Browse the repository at this point in the history
  • Loading branch information
Shipu committed Aug 22, 2024
1 parent e4973f6 commit 5743168
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/generate/stubs/relational/service.stub
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"{{PackageName}}/{{PackageRoot}}/{{SingularLowerName}}/dto"
"{{PackageName}}/{{PackageRoot}}/{{SingularLowerName}}/models"
"log"
"strconv"
"time"
)

Expand All @@ -18,8 +19,10 @@ func All{{TitleName}}(requestFilter map[string]interface{}) ([]models.{{TitleNam
}

paginationInstance := artifact.NewPaginator({{PluralLowerName}}, requestFilter)
page, _ := strconv.ParseInt(requestFilter["page"].(string), 10, 64)
limit, _ := strconv.ParseInt(requestFilter["limit"].(string), 10, 64)

models.{{TitleName}}Model.Where(filter).Scopes(paginationInstance.PaginateScope(requestFilter["page"].(int), requestFilter["limit"].(int))).Find(&{{PluralLowerName}})
models.{{TitleName}}Model.Where(filter).Scopes(paginationInstance.PaginateScope(int(page), int(limit))).Find(&{{PluralLowerName}})

return {{PluralLowerName}}, paginationInstance.Meta, nil

Expand Down

0 comments on commit 5743168

Please sign in to comment.