Skip to content

Commit

Permalink
add: gorm.DeletedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
cyz-home committed Aug 30, 2023
1 parent 61c7feb commit a0c1b09
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions console/commands/orm/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ func genOrmStruct(table string, columns []tableColumn, conf Conf, relationships
str := `type {TableName} struct {`
for _, column := range columns {
p := ""
if *column.IS_NULLABLE == "YES" && column.COLUMN_NAME != "deleted_at" {
if *column.IS_NULLABLE == "YES" && !(column.COLUMN_NAME == "deleted_at" && column.GoType == "database.Time") {
p = "*"
}
if column.COLUMN_NAME == "deleted_at" {
if column.COLUMN_NAME == "deleted_at" && column.GoType == "database.Time" {
column.GoType = "gorm.DeletedAt"
}

Expand Down

0 comments on commit a0c1b09

Please sign in to comment.