3 Commits

Author SHA1 Message Date
51d8531792 upd: README.md 2025-03-12 16:01:53 +07:00
da19da2d63 update: README.md 2025-03-12 15:58:34 +07:00
e1012c234c feat: sorting 2025-03-12 15:57:30 +07:00
3 changed files with 13 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
## Install ## Install
```shell ```shell
go install git.gogacoder.ru/NTO/crudgen/cmd/crudgen@v1.0.7 go install git.gogacoder.ru/NTO/crudgen/cmd/crudgen@1.0.11
``` ```
## Run ## Run

View File

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

View File

@@ -22,6 +22,7 @@ const GetByIdMethod = "GetById"
const UpdateMethod = "Update" const UpdateMethod = "Update"
const DeleteMethod = "Delete" const DeleteMethod = "Delete"
const CountMethod = "Count" const CountMethod = "Count"
const SortedByOrderMethod = "SortedByOrder"
var RawTemplates = map[string]string{ var RawTemplates = map[string]string{
CreateMethod: CreateRawTemplate, CreateMethod: CreateRawTemplate,
@@ -30,4 +31,5 @@ var RawTemplates = map[string]string{
UpdateMethod: UpdateRawTemplate, UpdateMethod: UpdateRawTemplate,
DeleteMethod: DeleteRawTemplate, DeleteMethod: DeleteRawTemplate,
CountMethod: CountRawTemplate, CountMethod: CountRawTemplate,
SortedByOrderMethod: SortedByOrderTemplate,
} }