structs for models

This commit is contained in:
2024-12-29 23:49:46 +07:00
parent a7f82bf8f2
commit b222a44833
5 changed files with 127 additions and 5 deletions

View File

@@ -21,12 +21,12 @@ func isGormValueNullable(tags *structtag.Tags) (*bool, error) {
return nil, nil
}
gormTag.Options = append([]string{gormTag.Name}, gormTag.Options...)
if err != nil {
return nil, nil
}
gormTag.Options = append([]string{gormTag.Name}, gormTag.Options...)
nullTagExist := gormTag.HasOption("null")
notNullTagExist := gormTag.HasOption("not null")
@@ -47,8 +47,8 @@ func CheckFieldNullConsistency(field ast.Field, structName string, structTags st
tags, err := structtag.Parse(structTags)
if err != nil {
return errors.New(fmt.Sprintf("Invalid structure tag: %s", err))
}
if tags == nil {
return nil
}