1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2025-01-17 08:56:48 +02:00

сделал FindTextDefaultValue()

This commit is contained in:
Nikitin Aleksandr 2023-11-27 11:26:33 +03:00
parent 9543983a66
commit 562c21dce4
3 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,4 @@
{ {
"ExtID": true, "ext_id": true,
"CreatedAt": false "created_at": false
} }

View File

@ -390,9 +390,15 @@ func FindCrudFunctionsURL() string {
func FindTextDefaultValue(Column1 *types.Column) string { func FindTextDefaultValue(Column1 *types.Column) string {
var Otvet string var Otvet string
ColumnName := Column1.Name
//ищем в файле настроек nullable.json
is_nullable_config, has_is_nullable_config := types.MapNullableFileds[ColumnName]
//
sValue := "" sValue := ""
Type_go := Column1.TypeGo Type_go := Column1.TypeGo
if Column1.TableKey != "" { if Column1.TableKey != "" && Column1.IsNullable == true && (is_nullable_config == true || has_is_nullable_config == false) {
sValue = "null" sValue = "null"
} else { } else {

View File

@ -344,6 +344,7 @@ func AddTextOmit(TextDB string, Table1 *types.Table) string {
TextOmit := "" TextOmit := ""
NullableCount := 0 NullableCount := 0
for _, Column1 := range Table1.MapColumns { for _, Column1 := range Table1.MapColumns {
ColumnName := Column1.Name
ColumnNameGo := Column1.NameGo ColumnNameGo := Column1.NameGo
TypeGo := Column1.TypeGo TypeGo := Column1.TypeGo
@ -352,7 +353,7 @@ func AddTextOmit(TextDB string, Table1 *types.Table) string {
} }
//ищем в файле настроек nullable.json //ищем в файле настроек nullable.json
is_nullable_config, has_is_nullable_config := types.MapNullableFileds[ColumnNameGo] is_nullable_config, has_is_nullable_config := types.MapNullableFileds[ColumnName]
if has_is_nullable_config == true && is_nullable_config == false { if has_is_nullable_config == true && is_nullable_config == false {
continue continue
} }