GORM Playground Link

https://github.com/go-gorm/playground/pull/824

Description

This is a duplicate of #7543 which the github bot keeps marking as stale.

The title says it all. So something like this will not work:

type Tree struct {
    ID        uint    `json:"id" gorm:"primaryKey"`
    IsAlive   bool    `json:"is_alive" gorm:"default:true"`
    Height    float64 `json:"height" gorm:"type:FLOAT"`
}

Comment From: 3xxx

I found that in sqlite,bool is numeric.

// MapElement 模型表示地图上的绘制元素
type MapElement struct {
    gorm.Model
    ProjectID   uint   `gorm:"index" json:"project_id"`
    Visible     bool   `gorm:"default:true" json:"visible"`
}

Image