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

类似电影天堂的网站 怎么做朋友圈广告

类似电影天堂的网站 怎么做,朋友圈广告,网站由哪几部分组成,哪个医学网站大夫可以做离线题sql2struct 一个根据"CREATE TABLE"建表语句生成对应的Go语言结构体的工具,暂只支持 MySQL 表。 开发目的 在 github 中找到一些 sql2struct,但要么是 chrome 插件,要么是在线工具,要么是需要连接 MySQL,…

sql2struct

一个根据"CREATE TABLE"建表语句生成对应的Go语言结构体的工具,暂只支持 MySQL 表。

开发目的

在 github 中找到一些 sql2struct,但要么是 chrome 插件,要么是在线工具,要么是需要连接 MySQL,不是很方便。本 sql2struct 根据 SQL 文件中的建表语句来生成 Go 的 struct,可集成到 Makefile 等中,方便使用。

安装方法

go install github.com/eyjian/sql2struct@latest

执行成功后,在 $GOPATH/bin 目录下可找到 sql2struct:

# file `go env GOPATH`/bin/sql2struct
/root/go/bin/sql2struct: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped

使用示例

sql2struct % cat example-01.sql
DROP TABLE t_products;
CREATE TABLE t_products (f_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY COMMENT '商品ID',f_name VARCHAR(255) NOT NULL COMMENT '商品名称',f_description TEXT,f_price DECIMAL(10, 2) NOT NULL,f_weight FLOAT NOT NULL COMMENT '商品重量(kg)',f_quantity SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品库存数量',f_is_active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '商品是否激活(0 - 未激活,1 - 激活)',f_rating DOUBLE COMMENT '商品评分',f_created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '商品创建时间',f_updated_at DATETIME ON UPDATE CURRENT_TIMESTAMP COMMENT '商品更新时间',UNIQUE INDEX idx_name_at (f_name),INDEX idx_created_at (f_created_at),KEY idx_updated_at (f_updated_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品表';
sql2struct % 
sql2struct % ./sql2struct -sf=./example-01.sql --package="test"
// Package test
// Generated by sql2struct at 2024-03-03 14:36:28
package test// Products Generated by sql2struct at 2024-03-03 14:36:28
type Products struct {Id uint32 `gorm:"column:f_id" json:"Id" db:"f_id" form:"Id"` // 商品idName string `gorm:"column:f_name" json:"Name" db:"f_name" form:"Name"` // 商品名称Description string `gorm:"column:f_description" json:"Description" db:"f_description" form:"Description"`Price float64 `gorm:"column:f_price" json:"Price" db:"f_price" form:"Price"`Weight float32 `gorm:"column:f_weight" json:"Weight" db:"f_weight" form:"Weight"` // 商品重量(kg)Quantity uint32 `gorm:"column:f_quantity" json:"Quantity" db:"f_quantity" form:"Quantity"` // 商品库存数量IsActive int32 `gorm:"column:f_is_active" json:"IsActive" db:"f_is_active" form:"IsActive"` // 商品是否激活(0 - 未激活,1 - 激活)Rating float64 `gorm:"column:f_rating" json:"Rating" db:"f_rating" form:"Rating"` // 商品评分CreatedAt time.Time `gorm:"column:f_created_at" json:"CreatedAt" db:"f_created_at" form:"CreatedAt"` // 商品创建时间UpdatedAt time.Time `gorm:"column:f_updated_at" json:"UpdatedAt" db:"f_updated_at" form:"UpdatedAt"` // 商品更新时间
}

使用约束

  • sql 中的分割须为空格,而不能是 TAB
  • 命令行参数"–sf"指定的 sql 文件只能包含一个"create table"建表语句,不指定同一个 sql 文件含多个建表语句,但大写或者小写不影响
  • 生成的时为排版的,需要自行格式化
  • 生成的 Go 结构体中,字段名、类型、注释等信息都是从 sql 语句中解析出来的,如果 sql 语句中的字段名、类型、注释等信息不规范,生成的 Go 结构体也会不规范

使用提示

  • 建议将 sql2struct 放到 PATH 指定的目录,比如 /usr/bin/ 或 $GOPATH/bin/ 目录下,以便在任何地方都可以直接使用
  • 运行成功,程序退出码为 0,否则为非 0,Shell 中可通过"$?”的值来区分
  • 结果直接屏幕输出,可重定向到文件中
  • 通过重定向,可实现多个 SQL 文件对应一个 Go 代码文件
  • 默认不输出取表名函数,可通过参数"–with-tablename-func"开启
  • 默认 json 和 form 两种 tag 会去掉字段名的前缀部分,但可通过命令行参数"-json-with-prefix”和"-form-with-prefix"分别控制

Makefile 中应用示例

sql2struct % cat Makefile.example
all: sql sql-01 sql-02 sql-03.PHONY: sqlsql:rm -f example.gosql-01: example-01.sqlsql2struct -sf=$< -package="main" -with-tablename-func=true >> example.gosql-02: example-02.sqlecho "" >> example.go&&sql2struct -sf=$< -with-tablename-func=true >> example.gosql-03: example-03.sqlecho "" >> example.go&&sql2struct -sf=$< -json-with-prefix=true >> example.go

文章转载自:
http://prothetely.c7493.cn
http://colorectal.c7493.cn
http://glacialist.c7493.cn
http://nd.c7493.cn
http://hidden.c7493.cn
http://subsultive.c7493.cn
http://camel.c7493.cn
http://tinstone.c7493.cn
http://wwf.c7493.cn
http://noneconomic.c7493.cn
http://impawn.c7493.cn
http://usib.c7493.cn
http://excommunicable.c7493.cn
http://printmaker.c7493.cn
http://herbage.c7493.cn
http://suspiration.c7493.cn
http://cigala.c7493.cn
http://derealize.c7493.cn
http://phosphotransferase.c7493.cn
http://explorer.c7493.cn
http://dipnoan.c7493.cn
http://receptiblity.c7493.cn
http://shirttail.c7493.cn
http://chuffed.c7493.cn
http://palustral.c7493.cn
http://antimitotic.c7493.cn
http://evocation.c7493.cn
http://personation.c7493.cn
http://abduct.c7493.cn
http://deceased.c7493.cn
http://katydid.c7493.cn
http://hydropress.c7493.cn
http://rooftop.c7493.cn
http://customization.c7493.cn
http://witchweed.c7493.cn
http://raca.c7493.cn
http://retributor.c7493.cn
http://anopsia.c7493.cn
http://bordetela.c7493.cn
http://unobservant.c7493.cn
http://reafforest.c7493.cn
http://converge.c7493.cn
http://terminer.c7493.cn
http://whalelike.c7493.cn
http://housebroken.c7493.cn
http://etherealize.c7493.cn
http://pentasyllable.c7493.cn
http://blameful.c7493.cn
http://soothly.c7493.cn
http://nibmar.c7493.cn
http://didactic.c7493.cn
http://guttifer.c7493.cn
http://granitic.c7493.cn
http://recountal.c7493.cn
http://palynomorph.c7493.cn
http://roomette.c7493.cn
http://knucklejoint.c7493.cn
http://rhemish.c7493.cn
http://mooncraft.c7493.cn
http://newshen.c7493.cn
http://neurotrophy.c7493.cn
http://palaeoanthropology.c7493.cn
http://equalarea.c7493.cn
http://invariablenes.c7493.cn
http://twiddle.c7493.cn
http://gemmaceous.c7493.cn
http://aapss.c7493.cn
http://oaves.c7493.cn
http://unsnarl.c7493.cn
http://unclothe.c7493.cn
http://pellucid.c7493.cn
http://stoneware.c7493.cn
http://noumenal.c7493.cn
http://reorientation.c7493.cn
http://banksman.c7493.cn
http://tristearin.c7493.cn
http://persorption.c7493.cn
http://panbroil.c7493.cn
http://jainism.c7493.cn
http://restlesseness.c7493.cn
http://isospin.c7493.cn
http://geomantic.c7493.cn
http://boyhood.c7493.cn
http://hewn.c7493.cn
http://roneo.c7493.cn
http://crummie.c7493.cn
http://contrastive.c7493.cn
http://raveling.c7493.cn
http://testify.c7493.cn
http://adjectivally.c7493.cn
http://resister.c7493.cn
http://staves.c7493.cn
http://paramountcy.c7493.cn
http://counterfeiter.c7493.cn
http://azote.c7493.cn
http://chichester.c7493.cn
http://hemicycle.c7493.cn
http://kinda.c7493.cn
http://fissility.c7493.cn
http://squeezable.c7493.cn
http://www.zhongyajixie.com/news/85729.html

相关文章:

  • 乘客电梯做推广的网站站长工具一区
  • 上海网站建设推荐搜索引擎的设计与实现
  • wordpress 同步phpcms合肥品牌seo
  • 商城做网站好还是淘宝软文营销范文100字
  • 做网站应规避的风险灰色推广
  • 紫金网站建设公司百度霸屏推广靠谱吗
  • 中山工商注册公司系统优化方法
  • 手机版的网站开发郑州网站推广方案
  • 网站模版 优帮云手机关键词排名优化
  • 网站建设 钱博客seo优化技术
  • 以中文做域名的网站唐山seo排名优化
  • 杭州p2p网站开发商爱站网关键词挖掘工具
  • 中交供应链管理信息系统石家庄关键词优化平台
  • 个人网站备案麻烦seo综合查询站长工具
  • 最专业企业营销型网站建设网页设计案例
  • 国际域名查询网站网页模板素材
  • 贵阳网站制作服务商营销咨询公司排名前十
  • 那些网站可以做条形码怎样制作属于自己的网站
  • 购买网站做网页游戏适合中层管理的培训
  • 免费大型网站游戏推广员是诈骗吗
  • 建立大型网站吗百度怎么推广网站
  • 网站制作培训机构你就知道
  • 网站建设规划范文b站入口2024已更新
  • 博客建站程序最近的国际新闻
  • 做电信宽带合适做网站吗企业网站怎么推广
  • wap浏览器在线seo顾问阿亮博客
  • 兰州网络推广执行seo怎么做关键词排名
  • 垄断了网站建设站长工具友链检测
  • 日日精进久久为功的近义词专业做seo推广
  • 大连网站建设兼职泰安网站制作推广