go-gorm / playground

GORM Playground (Please Create PR for this project to report issues)
MIT License
90 stars 688 forks source link

default issue(maybe) #617

Closed pedia closed 1 year ago

pedia commented 1 year ago

According to the model with default bool, it's not desired. Is this a bug?

type Policy struct {
    gorm.Model
    Name      string
    BoolFalse bool `gorm:"default:false"`
    BoolTrue  bool `gorm:"default:true"`
}
policy2 := Policy{Name: "policy20", BoolFalse: true, BoolTrue: false}
result2 := DB.Create(&policy2)
assert.False(t, policy2.BoolTrue) // NOT RIGHT HERE