miaogaolin / printlove-comment

0 stars 0 forks source link

tools/sql2gorm/ #2

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

在线工具:SQL转GORM Model - 潇洒哥和黑大帅 - Golang学习 - 英语学习

在线SQL转Golang Struct工具,SQL转GORM模型,SQL转Struct,SQL转Go

https://printlove.cn/tools/sql2gorm/

miaogaolin commented 3 years ago

目前有点bug,正在处理,有什么问题,可以在这留言

clearluo commented 3 years ago

create_at 和 update_at 无法转换

clearluo commented 3 years ago

很多数据类型都无法转换,时间,decimal

miaogaolin commented 3 years ago

create_at 和 update_at 无法转换

感谢提出来,现在已经处理好了.你可以看看

miaogaolin commented 3 years ago

很多数据类型都无法转换,时间,decimal

这个正在处理

miaogaolin commented 3 years ago

很多数据类型都无法转换,时间,decimal

你提出的问题都已处理,还增加了:

  1. 多表转化
  2. 相关包的导入
liu2015 commented 3 years ago

你这个是json转go sql转go 有没有逆反过来的转换.

miaogaolin commented 3 years ago

你这个是json转go sql转go 有没有逆反过来的转换.

这个没有,自己认为使用场景很少

ghost commented 2 years ago

字段类型后面可以不加 长度么 比如 id int(10) UNSIGNED NOT NULL AUTO_INCREMENT, 不应该是 type:int(10) unsigned; 而是type:int unsigned;

YangCSir commented 2 years ago

索引能处理下吗,现在没有处理索引

miaogaolin commented 2 years ago

欢迎提 PR: https://github.com/miaogaolin/gotl

samkeke commented 1 year ago

gorm:"column:id;type:int(10) unsigned;primary_key;AUTO_INCREMENT" json:"id" 的自动递增应改到type 里面,要不不生效 gorm:"column:id;type:int(11) unsigned auto_increment;primary_key;comment:自增id" json:"id"

xieang123 commented 1 year ago

时间类型,default:null没有生成

Heccc257 commented 1 year ago

似乎无法设置外键

jinsuojinsuo commented 1 year ago

要能支持生成索引就更好了

falcondeng commented 1 year ago

tinyint 类型的 转成 int8 或者 int32 就可以了, int 一般都是 int64,太大了

onestar-p commented 8 months ago

可以将 数据库列名 也输出出来吗?例如:

onestar-p commented 8 months ago
var BlacklistsColumns = struct {
    ID        string
    Email     string
    Type      string
    CreatedAt string
    UpdatedAt string
}{
    ID:        "id",
    Email:     "email",
    Type:      "type",
    CreatedAt: "created_at",
    UpdatedAt: "updated_at",
}
willis-yang commented 5 months ago

sqlite是不是还没支持?

miaogaolin commented 5 months ago

sqlite是不是还没支持?

还没有