mirror of
https://github.com/opbnq-q/nto-cli.git
synced 2025-12-06 19:40:34 +07:00
feat: new parser & generator
This commit is contained in:
@@ -2,18 +2,18 @@ package generation
|
||||
|
||||
import (
|
||||
"log"
|
||||
"nto_cli/entities"
|
||||
"nto_cli/model"
|
||||
"nto_cli/utils"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Generate(structName string, fields []entities.Field) {
|
||||
mkPath := filepath.Join(utils.FindFrontendPath(), strings.ToLower(structName))
|
||||
func Generate(model *model.Model) {
|
||||
mkPath := filepath.Join(utils.FindFrontendPath(), strings.ToLower(model.Name))
|
||||
if err := os.Mkdir(mkPath, 0755); err != nil {
|
||||
log.Fatalf("Failed to mkdir for model: %s", err)
|
||||
}
|
||||
GenerateService(structName, mkPath)
|
||||
GenerateScheme(structName, fields, mkPath)
|
||||
GenerateService(model, mkPath)
|
||||
GenerateScheme(model, mkPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user