go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

goctl gen model mysql from datasource do not return sql.Nullstring sql.Int64 with Null column

Open handestd opened this issue 1 year ago • 5 comments

i used this command goctl model mysql datasource --url "root:@tcp(127.0.0.1:3306)/qrmenu" --dir ./internal/model --style go_zero --table "*" --cache=true

my table structure `-- auto-generated definition create table group_topping_option ( id varchar(255) not null primary key, shop_id varchar(255) null, group_topping_id varchar(255) null, name varchar(255) null, price int null, create_at datetime default current_timestamp() not null, update_at datetime default current_timestamp() not null on update current_timestamp(), create_by varchar(255) not null, update_by varchar(255) not null );

`

the result i receive:

GroupToppingOption struct { Id string db:"id" ShopId string db:"shop_id" GroupToppingId string db:"group_topping_id" Name string db:"name" Price int64 db:"price" CreateAt time.Time db:"create_at" UpdateAt time.Time db:"update_at" CreateBy string db:"create_by" UpdateBy string db:"update_by" }

I expected Nullstring, NullInt64,..

handestd avatar Aug 27 '24 17:08 handestd

Duplicate of #4337?

kevwan avatar Aug 28 '24 12:08 kevwan

Duplicate of #4337?

Yes, i think i didn't explain clearly

handestd avatar Aug 28 '24 12:08 handestd

Duplicate of #4337?

can you explain is this a goctl bug or am i doing something wrong, thanks

handestd avatar Aug 28 '24 12:08 handestd

@kesonan

kevwan avatar Aug 28 '24 14:08 kevwan

I need help

handestd avatar Aug 29 '24 04:08 handestd

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Sep 02 '25 02:09 github-actions[bot]