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/entities_tables/entities_tables.go
2024-09-17 15:43:42 +03:00

63 lines
1.6 KiB
Go

package entities_tables
import (
"github.com/ManyakRus/crud_generator/internal/config"
"github.com/ManyakRus/crud_generator/internal/create_files"
"github.com/ManyakRus/crud_generator/internal/types"
"github.com/ManyakRus/starter/log"
)
// CreateAllFiles - создаёт все файлы в папке model
func CreateAllFiles(MapAll map[string]*types.Table) error {
var err error
//для каждой таблицы
for _, Table1 := range MapAll {
//проверка имени таблицы "DELETED_"
err1 := create_files.IsGood_TableNamePrefix(Table1)
if err1 != nil {
log.Warn("CreateFiles() table: ", Table1.Name, " warning: ", err)
continue
}
//создание файлов
err = CreateFiles(Table1)
if err != nil {
log.Error("CreateFiles() table: ", Table1.Name, " error: ", err)
return err
}
if config.Settings.NEED_CREATE_UPDATE_EVERY_COLUMN == true {
err = CreateFiles_UpdateEveryColumn(Table1)
if err != nil {
log.Error("CreateFiles() table: ", Table1.Name, " error: ", err)
return err
}
//
err = CreateFiles_FindBy(Table1)
if err != nil {
log.Error("CreateFiles_FindBy() table: ", Table1.Name, " error: ", err)
return err
}
//FindMassBy
err = CreateFiles_FindMassBy(Table1)
if err != nil {
log.Error("CreateFiles_FindMassBy() table: ", Table1.Name, " error: ", err)
return err
}
//ReadAll
err = CreateFiles_ReadAll(Table1)
if err != nil {
log.Error("CreateFiles_ReadAll() table: ", Table1.Name, " error: ", err)
return err
}
}
}
return err
}