1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-11-21 05:05:52 +02:00

сделал objects

This commit is contained in:
Nikitin Aleksandr 2024-11-02 13:50:06 +03:00
parent b0bd1d9d7d
commit 29b00469ee
4 changed files with 16 additions and 8 deletions

View File

@ -220,6 +220,7 @@ type SettingsINI struct {
NEED_USE_DB_VIEWS bool
//Objects
NEED_CREATE_OBJECTS bool
PREFIX_OBJECT string
TEMPLATE_FOLDERNAME_OBJECTS string
TEMPLATES_OBJECTS_FILENAME string
@ -1187,6 +1188,11 @@ func FillSettings() {
s = Getenv(Name, true)
Settings.TEXT_DELETED_COLUMN_RUS = s
//
Name = "NEED_CREATE_OBJECTS"
s = Getenv(Name, true)
Settings.NEED_CREATE_OBJECTS = BoolFromString(s)
}
// CurrentDirectory - возвращает текущую директорию ОС

View File

@ -2780,7 +2780,7 @@ func IsGood_ColumnNamePrefix(Column1 *types.Column) error {
HasPrefix := strings.HasPrefix(ColumnName, config.Settings.TEXT_DELETED_COLUMN)
HasPrefixRus := strings.HasPrefix(ColumnName, config.Settings.TEXT_DELETED_COLUMN_RUS)
if HasPrefix == true || HasPrefixRus == true {
TextError := fmt.Sprint("Wrong column: ", ColumnName, " error: name = DELETED_")
TextError := fmt.Sprint("Wrong column: ", ColumnName, ", error: name prefix= "+config.Settings.TEXT_DELETED_COLUMN)
err = errors.New(TextError)
}
@ -2795,7 +2795,7 @@ func IsGood_ColumnCommentPrefix(Column1 *types.Column) error {
HasPrefix := strings.HasPrefix(ColumnComment, config.Settings.TEXT_DELETED_COLUMN)
HasPrefixRus := strings.HasPrefix(ColumnComment, config.Settings.TEXT_DELETED_COLUMN_RUS)
if HasPrefix == true || HasPrefixRus == true {
TextError := fmt.Sprint("Wrong table: ", ColumnComment, " error: comment: ", ColumnComment)
TextError := fmt.Sprint("Wrong column: ", Column1.Name, ", error: comment prefix: ", ColumnComment)
err = errors.New(TextError)
}

View File

@ -94,8 +94,8 @@ func CreateFiles1(MapAll map[string]*types.Table, Table1 *types.Table, TextGo st
TextField := ""
for _, Column1 := range Table1.MapColumns {
//проверка имени колонки "DELETED_"
err1 := create_files.IsGood_Column(Column1)
if err1 != nil {
err = create_files.IsGood_Column(Column1)
if err != nil {
log.Warn("CreateFiles1() table: ", Table1.Name, " column: ", Column1.Name, " warning: ", err)
}

View File

@ -233,10 +233,12 @@ func StartFillAll() error {
}
//objects
err = object_tables.CreateAllFiles(MapAll)
if err != nil {
//log.Error("env_file.CreateAllFiles() error: ", err)
return err
if config.Settings.NEED_CREATE_OBJECTS == true {
err = object_tables.CreateAllFiles(MapAll)
if err != nil {
//log.Error("env_file.CreateAllFiles() error: ", err)
return err
}
}
return err