1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-16 21:52:42 +02:00
crud_generator/internal/create_files/object_tables/object_tables.go

42 lines
1023 B
Go
Raw Normal View History

2024-11-02 10:53:38 +02:00
package object_tables
import (
"github.com/ManyakRus/crud_generator/internal/create_files"
"github.com/ManyakRus/crud_generator/internal/types"
"github.com/ManyakRus/starter/log"
2024-11-05 15:58:59 +02:00
"github.com/ManyakRus/starter/micro"
2024-11-02 10:53:38 +02:00
)
// CreateAllFiles - создаёт все файлы в папке model
func CreateAllFiles(MapAll map[string]*types.Table) error {
var err error
//для каждой таблицы
2024-11-05 15:58:59 +02:00
MassAll := micro.MassFrom_Map(MapAll)
for _, Table1 := range MassAll {
2024-11-02 10:53:38 +02:00
//проверка имени таблицы "DELETED_"
2024-11-05 15:58:59 +02:00
err1 := create_files.IsGood_TableName(Table1)
2024-11-02 10:53:38 +02:00
if err1 != nil {
2024-11-05 15:58:59 +02:00
log.Warn("CreateFiles() table: ", Table1.Name, ", warning: ", err1)
2024-11-02 10:53:38 +02:00
continue
}
2024-11-06 10:38:10 +02:00
//model
2024-11-02 10:53:38 +02:00
err = CreateFiles(MapAll, Table1)
if err != nil {
2024-11-05 15:58:59 +02:00
log.Error("CreateFiles() table: ", Table1.Name, ", error: ", err)
2024-11-02 10:53:38 +02:00
return err
}
2024-11-06 10:38:10 +02:00
//crud
err = CreateFiles_crud(MapAll, Table1)
if err != nil {
log.Error("CreateFiles() table: ", Table1.Name, ", error: ", err)
return err
}
2024-11-02 10:53:38 +02:00
}
return err
}