smallnest / gen

Converts a database into gorm structs and RESTful api
Apache License 2.0
1.43k stars 234 forks source link

Use sql.NullInt32 for INT4 #163

Closed krhubert closed 3 years ago

krhubert commented 3 years ago

Hi,

I would like to keep a more consistent types between database type and go struct, therefore it would be great to use sq.NullInt32 for db INT4

type S struct {
    //[ 0] id INT4                 null: true   primary:     false  isArray: false  auto: false  col: INT4            len: -1      default: []
    ID sql.NullInt64 `gorm:"column:user_id;type:INT4;"`
}
smallnest commented 3 years ago

updated.

And will use sql.NullInt16 for INT2 if go 1.17 is released