工具快速访问
- JSON 转 GO: https://www.printlove.cn/tools/json2go
- YAML 转 GO: https://www.printlove.cn/tools/yaml2go
- SQL 转 go-zero Model: https://printlove.cn/tools/sql2gozero
- SQL 转 GORM Model: https://www.printlove.cn/tools/sql2gorm
- SQL 转 ElasticSearch DSL: https://printlove.cn/tools/sql2es/
- SQL 转 entgo schema: https://printlove.cn/tools/sql2ent
JSON转GO
1. 有两种模式
- 转化-展开:json中的所有对象都创建为新的struct
- 转化-嵌套:json中的对象都包含到一个struct中
2. 自定义tag
默认转化后的tag
是json
,也可以自定义,比如可以改为:gorm
3. 效果图
YAML转GO
将 yaml 格式自动转化为 Go Struct 结构。
效果图
SQL 转 ent
1. 效果图
2. 功能
- 此工具提供将 SQL 语句转化为
ent schema
- 提供常见的数据库类型到 field 函数的转化
SQL 转 ElasticSearch DSL
1. 效果图
2. 当前支持
- sql and expression
- sql or expression
- equal(=) support
- not equal(!=) support
- gt(>) support
- gte(>=) support
- lt(<) support
- lte(<=) support
- sql in (eg. id in (1,2,3) ) expression
- sql not in (eg. id not in (1,2,3) ) expression
- paren bool support (eg. where (a=1 or b=1) and (c=1 or d=1))
- sql like expression (currently use match phrase, perhaps will change to wildcard in the future)
- sql order by support
- sql limit support
- sql not like expression
- field missing check
- support aggregation like count(*), count(field), min(field), max(field), avg(field)
- support aggregation like stats(field), extended_stats(field), percentiles(field) which are not standard sql function
- null check expression(is null/is not null)
- join expression
- having support
SQL转go-zero
1. 效果图
2. 功能
和官方的 goctl 工具生成的代码是一样的,同样支持是否带缓存的Model。
SQL转GORM Model
1. 效果图
2. 功能
- 支持多表
- 支持引入包的导入
點擊查看更多內容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦