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

修复mysql 生成struct 没有属性的bug #31

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions dbmeta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,14 @@ const (
gureguNullTime = "null.Time"
golangTime = "time.Time"
golangBool = "bool"

)

// driverDialect is a registry, mapping database/sql driver names to database dialects.
// This is somewhat fragile.
var tableNameFormat map[string]string = map[string]string{
"sqlite": "`%s`",
"postgres": `"%s"`,
"mysql": "`%s`",
"mysql": "%s",
"mssql": "[%s]",
"oracle": `"%s"`,
}
Expand Down Expand Up @@ -213,15 +212,15 @@ func sqlTypeToGoType(mysqlType string, nullable bool, gureguTypes bool) string {
return sqlNullInt
}
return golangInt
case "bigint","int8":
case "bigint", "int8":
if nullable {
if gureguTypes {
return gureguNullInt
}
return sqlNullInt
}
return golangInt64
case "char", "enum", "varchar", "longtext", "mediumtext", "text", "tinytext","varchar2","json","jsonb":
case "char", "enum", "varchar", "longtext", "mediumtext", "text", "tinytext", "varchar2", "json", "jsonb":
if nullable {
if gureguTypes {
return gureguNullString
Expand Down Expand Up @@ -258,4 +257,3 @@ func sqlTypeToGoType(mysqlType string, nullable bool, gureguTypes bool) string {

return ""
}