go 的一个orm generator,生成model对

纵然是瞬间 提交于 2020-08-04 21:05:51

用于生成Go的Model文件,数据库操作太过于麻烦,依靠工具可以直接生成model对象,默认使用的是xorm映射。

需要支持Go mod ,所以版本最好1.11以上

下载:

go get -u github.com/anthony-dong/orm-generator

执行
./build.sh

或者 release里下载压缩版

~/Downloads/orm-generator-1.0 % ls
LICENSE   README.md bin       build.sh  cmd       generator go.mod    go.sum    utils
~/Downloads/orm-generator-1.0 % ./build.sh
GOPATH: /Users/sgcx015/go
GOBIN: /Users/sgcx015/Downloads/orm-generator-1.0/bin/
CURDIR: /Users/sgcx015/Downloads/orm-generator-1.0
WORK=/var/folders/cs/_wm77lv95j5d88s_q9vr959w0000gn/T/go-build403299929
build finished
sgcx015@SGCX015deMacBook-Pro:~/Downloads/orm-generator-1.0 % bin/orm-generator

快速开始

~/go/code/orm-generator (master*) % bin/orm-generator -u=root -p=123456 -d=xorm -t=users -tag=xorm
generate template finished
~/go/code/orm-generator/tmp (master*) % cat tmp/users.go
package model

import (
	"time"
)

type Users struct {
	ID      uint32    `xorm:"id"`
	Name    string    `xorm:"name"`
	Age     uint32    `xorm:"age"`
	Date    time.Time `xorm:"date"`
	ClassID uint32    `xorm:"class_id"`
}

func (u Users) TableName() string {
	return "users"
}

mixcloud.com/myhkjsak/
mixcloud.com/zamwtzbj/
mixcloud.com/95270906/
mixcloud.com/72974262/
mixcloud.com/hesujzjh/
mixcloud.com/byfubrkz/
mixcloud.com/jpdyhhcz/
mixcloud.com/hhjxruvn/
mixcloud.com/orztaequ/
mixcloud.com/nflrgvvv/
mixcloud.com/zpziezra/
mixcloud.com/rpksqojb/
mixcloud.com/ebytqwgq/
mixcloud.com/firgwbbm/
mixcloud.com/53178242/
mixcloud.com/62227683/
mixcloud.com/45447629/
mixcloud.com/06548427/
mixcloud.com/58134375/
mixcloud.com/srywrxiq/
mixcloud.com/kkmgmsxm/
mixcloud.com/fhgdxcqn/
mixcloud.com/brtsezjh/
mixcloud.com/88791307/
mixcloud.com/hpqecbnm/
mixcloud.com/nudgibcw/
mixcloud.com/pvxnfcvn/
mixcloud.com/dhcvrqbw/
mixcloud.com/aqfagffo/
mixcloud.com/busbzgkc/
mixcloud.com/02030696/
mixcloud.com/kpgcaytf/
mixcloud.com/43434995/
mixcloud.com/jfutpfuc/
mixcloud.com/85935516/
mixcloud.com/63686904/
mixcloud.com/lzskqhkw/
mixcloud.com/iofneudc/
mixcloud.com/drqoqkfi/
mixcloud.com/58494381/
mixcloud.com/53148782/
mixcloud.com/lsdlpmom/
mixcloud.com/eeuitytj/
mixcloud.com/xbhnqmqn/
mixcloud.com/rdemlnzj/
mixcloud.com/vdwopooq/
mixcloud.com/ijtadzep/
mixcloud.com/hlzrgmtj/
mixcloud.com/keovmskl/
mixcloud.com/61405653/
mixcloud.com/fduxejut/
mixcloud.com/44422502/
mixcloud.com/93270651/
mixcloud.com/tgpeqayz/
mixcloud.com/wdubhmvv/
mixcloud.com/48024461/
mixcloud.com/yzjkbzhu/
mixcloud.com/78335813/
mixcloud.com/bylytqxl/
mixcloud.com/fvsxfykl/
mixcloud.com/vmeqgbuk/
mixcloud.com/gnxlydim/
mixcloud.com/ajitpszd/
mixcloud.com/stujshsi/
mixcloud.com/33313791/
mixcloud.com/iukybtfi/
mixcloud.com/dvwwyuxy/
mixcloud.com/qeqcpkbq/
mixcloud.com/skelxlkm/
mixcloud.com/92714564/
mixcloud.com/aleelisd/
mixcloud.com/uznxfydt/
mixcloud.com/26301075/
mixcloud.com/45439897/
mixcloud.com/89694915/
mixcloud.com/66605373/
mixcloud.com/54712279/
mixcloud.com/strlmoog/
mixcloud.com/uckeyrdt/
mixcloud.com/03380771/
mixcloud.com/44394221/
mixcloud.com/12958097/
mixcloud.com/74962985/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!