sqlserver
sqlserver copied to clipboard
fix: failed to modify field comment when empty due to incorrect conditions
- [x] Do only one thing
- [x] Non breaking API changes
GetColumnComment(*gorm.Statement, string) string=>GetColumnComment(*gorm.Statement, string) sql.NullString
- [x] Tested
What did this pull request do?
@jinzhu Fix issue where modifying field comments failed when the field comment was an empty string due to incorrect judgment conditions.
User Case Description
type TestTableFieldComment struct {
ID string `gorm:"column:id;primaryKey;comment:"` // field comment is an empty string
// ...
}
func (*TestTableFieldComment) TableName() string { return "test_table_field_comment" }
// =>
type TestTableFieldCommentUpdate struct {
ID string `gorm:"column:id;primaryKey;comment:ID"`
// ...
}
func (*TestTableFieldCommentUpdate) TableName() string { return "test_table_field_comment" }