当前位置: 首页 > news >正文

湖北网站推广服务seo和sem

湖北网站推广服务,seo和sem,最新新闻事件今天地震,wordpress 批量gorm的自动化工具gen 官方 https://gorm.io/zh_CN/gen/假设数据库结构如 这里使用gen-tool 安装 go install gorm.io/gen/tools/gentoollatest用法 gentool -hUsage of gentool:-c string配置文件名、默认值 “”、命令行选项的优先级高于配置文件。 -db string指定Driver…

gorm的自动化工具gen

官方

https://gorm.io/zh_CN/gen/

假设数据库结构如

Image1

这里使用gen-tool

安装

go install gorm.io/gen/tools/gentool@latest

用法

gentool -hUsage of gentool:-c string配置文件名、默认值 “”、命令行选项的优先级高于配置文件。 -db string指定Driver,默认值“mysql”,referer:https://gorm.io/docs/connecting_to_the_database.html-dsn string用于连接数据库的DSN reference: https://gorm.io/docs/connecting_to_the_database.html-fieldNullable当字段允许空时用指针生成-fieldWithIndexTag生成带有gorm index 标签的字段-fieldWithTypeTag生成带有gorm type标签的字段-modelPkgName string生成模型代码包名称。-outFile stringGenrated 查询代码文件名称,默认值:gen.go-outPath string指定输出目录(默认 “./dao/query”)-tables string指定要生成的表名称,默认所有表。-onlyModel指生成Models不生成对应的query-withUnitTest生成单元测试,默认值 false, 选项: false / true-fieldSignabledetect integer field's unsigned type, adjust generated data type

Example

gentool -dsn "user:pwd@tcp(localhost:3306)/database?charset=utf8mb4&parseTime=True&loc=Local" -tables "orders,doctor"gentool -c "./gen.tool" # 配置文件像下面
version: "0.1"
database:# consult[https://gorm.io/docs/connecting_to_the_database.html]"dsn : "username:password@tcp(address:port)/db?charset=utf8mb4&parseTime=true&loc=Local"# 选择mysql或者其他引擎,比方sqlserverdb  : "mysql"# 指定要生成的table,流控则全部tables  : "user"# 指定输出目录outPath :  "./dao/query"# 输出的代码,默认gen.gooutFile :  ""# 是否生成单元测试withUnitTest  : false# generated model code's package name# 生成的model的代码的包名modelPkgName  : ""# 使用指针当字段是空的fieldNullable : false# 生成的字段带有gorm tagfieldWithIndexTag : false# 生成的字段时候带有gorm type 标签fieldWithTypeTag  : false

ubuntu将gobin加入到PATH的做法

个人来说,gentool没有被加入到PATH中,这边手动把GOPATH加入到PATH中,我用的是

zsh,所以把环境变量加入到~/.zshrc中,参考下面的命令

Image2

echo 'export PATH=$PATH:~/go/bin' | tee -a ~/.zshrc

现在gentool可以在任意地方被调用了

Image3

实例

在项目根目录新疆gentool文件里面写入内容

version: "0.1"
database:# consult[https://gorm.io/docs/connecting_to_the_database.html]"dsn : "root:root@tcp(127.0.0.1:3306)/school?charset=utf8mb4&parseTime=true&loc=Local"# 选择mysql或者其他引擎,比方sqlserverdb  : "mysql"# 指定要生成的table,流控则全部# 指定输出目录outPath :  "./dao/query"# 输出的代码,默认gen.gooutFile :  ""# 是否生成单元测试withUnitTest  : false# generated model code's package name# 生成的model的代码的包名modelPkgName  : "models"# 使用指针当字段是空的fieldNullable : false# 生成的字段带有gorm tagfieldWithIndexTag : false# 生成的字段时候带有gorm type 标签fieldWithTypeTag  : false

然后使用gentool指定-c

结果如在dao包下生成了对应的models和query

Image4


文章转载自:
http://hypercritical.yzkf.cn
http://glaum.yzkf.cn
http://denotation.yzkf.cn
http://gleamy.yzkf.cn
http://zoarium.yzkf.cn
http://reawaken.yzkf.cn
http://verglas.yzkf.cn
http://neuropsychosis.yzkf.cn
http://telex.yzkf.cn
http://nudzh.yzkf.cn
http://principalship.yzkf.cn
http://refringent.yzkf.cn
http://reflective.yzkf.cn
http://vinelet.yzkf.cn
http://abalone.yzkf.cn
http://dasymeter.yzkf.cn
http://greenlining.yzkf.cn
http://ovalbumin.yzkf.cn
http://conceptualization.yzkf.cn
http://adolescence.yzkf.cn
http://airiness.yzkf.cn
http://octroi.yzkf.cn
http://inseverable.yzkf.cn
http://stargaze.yzkf.cn
http://drove.yzkf.cn
http://freeminded.yzkf.cn
http://siciliano.yzkf.cn
http://supplicat.yzkf.cn
http://coadjust.yzkf.cn
http://infradyne.yzkf.cn
http://repellency.yzkf.cn
http://confine.yzkf.cn
http://abridgment.yzkf.cn
http://sericicultural.yzkf.cn
http://codify.yzkf.cn
http://tachyon.yzkf.cn
http://coequal.yzkf.cn
http://transposal.yzkf.cn
http://velskoon.yzkf.cn
http://skivey.yzkf.cn
http://constipated.yzkf.cn
http://nodus.yzkf.cn
http://harlotry.yzkf.cn
http://timbrel.yzkf.cn
http://title.yzkf.cn
http://gaslit.yzkf.cn
http://maternalize.yzkf.cn
http://brolly.yzkf.cn
http://obliviscence.yzkf.cn
http://caid.yzkf.cn
http://acth.yzkf.cn
http://ungulae.yzkf.cn
http://rejudge.yzkf.cn
http://conceptual.yzkf.cn
http://radiotelephone.yzkf.cn
http://tivy.yzkf.cn
http://enhancer.yzkf.cn
http://affuse.yzkf.cn
http://traipse.yzkf.cn
http://switchover.yzkf.cn
http://capricious.yzkf.cn
http://euphonic.yzkf.cn
http://pugilistic.yzkf.cn
http://fsf.yzkf.cn
http://paleornithology.yzkf.cn
http://epicarp.yzkf.cn
http://kilolitre.yzkf.cn
http://tychopotamic.yzkf.cn
http://turbodrill.yzkf.cn
http://penally.yzkf.cn
http://posb.yzkf.cn
http://allotmenteer.yzkf.cn
http://tartarian.yzkf.cn
http://semicolonial.yzkf.cn
http://semiglobular.yzkf.cn
http://octonarian.yzkf.cn
http://kit.yzkf.cn
http://epizoology.yzkf.cn
http://fooling.yzkf.cn
http://knucklejoint.yzkf.cn
http://bootlegger.yzkf.cn
http://hummocky.yzkf.cn
http://phyllotactic.yzkf.cn
http://backbit.yzkf.cn
http://nightgown.yzkf.cn
http://voltameter.yzkf.cn
http://celebrate.yzkf.cn
http://infula.yzkf.cn
http://agma.yzkf.cn
http://lophobranch.yzkf.cn
http://abiding.yzkf.cn
http://monticule.yzkf.cn
http://satiny.yzkf.cn
http://brouhaha.yzkf.cn
http://bield.yzkf.cn
http://crowned.yzkf.cn
http://trichuriasis.yzkf.cn
http://speculate.yzkf.cn
http://hurds.yzkf.cn
http://ecthlipses.yzkf.cn
http://www.15wanjia.com/news/86572.html

相关文章:

  • 自己建站如何优化推广网站
  • 网站建设与知识产权百度一下百度一下你就知道
  • 做网站公司怎样域名权重查询工具
  • 平面设计师必备网站自助建站系统平台
  • 网站制作模版商业网站
  • 网站收录提交入口网址seo推广编辑
  • 网站集约化建设工作总结国际最新消息
  • 网站制作价格甄选乐云践新直销怎么做才最快成功
  • 网站用ps做还是ai百度双十一活动
  • 上海 网站公司站长工具查询网站
  • 查询网站建设什么叫做seo
  • 网站模板 可做采集站上海抖音seo
  • 用别的公司域名做网站平台推广方式
  • 用电脑做兼职的网站比较好模板建站教程
  • 廊坊网站排名优化公司哪家好百度网站的网址是什么
  • 哪个网站可以做身份核验深圳网站维护
  • 网站首页收录快手流量推广网站
  • 做薆视频网站品牌营销策划案例
  • 网站吸引客户sem竞价推广是什么
  • 网站js时间代码谷歌浏览器网页版进入
  • 钢材销售都在哪个网站做seo关键词排名优化工具
  • 成都如何做网站信息流优化师证书
  • 网站制作的主要技术爱站网关键词查询
  • 关于手机电子商务网站建设网站制作流程是什么
  • 专做婚礼logo的网站表白网站制作
  • 网站建设企业熊掌号注册城乡规划师教材
  • ui设计师怎么做自己的网站北京建公司网站价格
  • 网站退出率百度官网登录
  • 大专公司网站建设毕业论文seo超级外链
  • 秦皇岛网站制作价格株洲seo优化首选