Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why the struct don't have member? #26

Closed
liaosimin opened this issue Nov 20, 2019 · 4 comments
Closed

why the struct don't have member? #26

liaosimin opened this issue Nov 20, 2019 · 4 comments

Comments

@liaosimin
Copy link

gen -c 'mitra:shopee123!@tcp(10.12.77.233)/apc_report_db?&parseTime=True' --database apc_report_db -t dp_order_report_tab --package dbreport --json --gorm --guregu

package model

import (
"database/sql"
"time"

"github.com/guregu/null"

)

var (
_ = time.Second
_ = sql.LevelDefault
_ = null.Bool{}
)

type DpOrderReportTab struct {
}

// TableName sets the insert table name for this struct type
func (d *DpOrderReportTab) TableName() string {
return "dp_order_report_tab"
}

@smallnest
Copy link
Owner

maybe it is mysql 8.0 problem, see #25 .

If you can use this mysql dsn string to login your mysql, gen should succeed to generate those code.

If it is not mysql 8.0 problem, maybe your table has some special defination, you can paste the table here

@liaosimin
Copy link
Author

CREATE TABLE report_info_tab (
name varchar(255) NOT NULL,
csv_url varchar(1024) DEFAULT NULL,
status tinyint(3) unsigned NOT NULL DEFAULT '0',
cron_schedule varchar(255) NOT NULL,
last_exec_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
create_time timestamp NULL DEFAULT CURRENT_TIMESTAMP,
update_time timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

@smallnest
Copy link
Owner

see #25

@smallnest
Copy link
Owner

also #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants