Compare commits
3 Commits
v1.0.10
...
50edeb07ca
| Author | SHA1 | Date | |
|---|---|---|---|
| 50edeb07ca | |||
| 31c5c49589 | |||
| 51d8531792 |
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
```shell
|
```shell
|
||||||
go install git.gogacoder.ru/NTO/crudgen/cmd/crudgen@v1.0.9
|
go install git.gogacoder.ru/NTO/crudgen/cmd/crudgen@v1.0.13
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|||||||
@@ -58,3 +58,5 @@ const CountRawTemplate = `func (service *{{.ServiceName}}) Count() (int64, error
|
|||||||
const SortedByOrderTemplate = `func (service *{{.ServiceName}}) SortedByOrder(fieldsSortOrder map[string]string) ([]*{{.EntityType}}, error) {
|
const SortedByOrderTemplate = `func (service *{{.ServiceName}}) SortedByOrder(fieldsSortOrder map[string]string) ([]*{{.EntityType}}, error) {
|
||||||
return utils.SortByOrder(fieldsSortOrder, {{.EntityType}}{})
|
return utils.SortByOrder(fieldsSortOrder, {{.EntityType}}{})
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
var implementedMethods = []string{CreateMethod, GetAllMethod, GetByIdMethod, UpdateMethod, DeleteMethod, CountMethod, SortedByOrderMethod}
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ func ImplementCrudMethods(modelName string, serviceName string, file *dst.File,
|
|||||||
EntityPlural: ToPlural(modelName),
|
EntityPlural: ToPlural(modelName),
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, methodName := range []string{CreateMethod, GetAllMethod, GetByIdMethod, UpdateMethod, DeleteMethod, CountMethod} {
|
for _, methodName := range implementedMethods {
|
||||||
methodCode := GenerateCrudMethodCode(methodName, templateContext)
|
methodCode := GenerateCrudMethodCode(methodName, templateContext)
|
||||||
methodDecl, err := MethodCodeToDeclaration(methodCode)
|
methodDecl, err := MethodCodeToDeclaration(methodCode)
|
||||||
fmt.Printf("%s\n", methodCode)
|
fmt.Printf("%s\n", methodCode)
|
||||||
|
|||||||
Reference in New Issue
Block a user