1 Commits

Author SHA1 Message Date
e1012c234c feat: sorting 2025-03-12 15:57:30 +07:00
2 changed files with 12 additions and 6 deletions

View File

@@ -54,3 +54,7 @@ const CountRawTemplate = `func (service *{{.ServiceName}}) Count() (int64, error
amount, err := dal.{{.EntityType}}.Count()
return amount, err
}`
const SortedByOrderTemplate = `func (service *{{.ServiceName}}) SortedByOrder(fieldsSortOrder map[string]string) ([]*{{.EntityType}}, error) {
return utils.SortByOrder(fieldsSortOrder, {{.EntityType}}{})
}`

View File

@@ -22,12 +22,14 @@ const GetByIdMethod = "GetById"
const UpdateMethod = "Update"
const DeleteMethod = "Delete"
const CountMethod = "Count"
const SortedByOrderMethod = "SortedByOrder"
var RawTemplates = map[string]string{
CreateMethod: CreateRawTemplate,
GetAllMethod: GetAllRawTemplate,
GetByIdMethod: GetByIdRawTemplate,
UpdateMethod: UpdateRawTemplate,
DeleteMethod: DeleteRawTemplate,
CountMethod: CountRawTemplate,
CreateMethod: CreateRawTemplate,
GetAllMethod: GetAllRawTemplate,
GetByIdMethod: GetByIdRawTemplate,
UpdateMethod: UpdateRawTemplate,
DeleteMethod: DeleteRawTemplate,
CountMethod: CountRawTemplate,
SortedByOrderMethod: SortedByOrderTemplate,
}