feat: new parser & generator

This commit is contained in:
2025-03-09 13:12:12 +07:00
parent 70fc3345d8
commit a3283b9a57
25 changed files with 372 additions and 301 deletions

View File

@@ -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)
}