xorm reverse mysql_xorm 工具
# xorm 工具
xorm 是一组数据库操作命令行工具。
### 二进制安装
如果你安装了 [got](https://github.com/gobuild/got),你可以输入如下命令安装:
~~~
got go-xorm/cmd/xorm
~~~
或者你可以从 [gobuild](http://gobuild.io/download/github.com/lunny/got) 下载后解压到可执行路径。
### 源码安装
`go get github.com/go-xorm/cmd/xorm`
同时你需要安装如下依赖:
-
github.com/go-xorm/xorm
-
Mysql: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
-
MyMysql: [github.com/ziutek/mymysql/godrv](https://github.com/ziutek/mymysql/godrv)
-
Postgres: [github.com/lib/pq](https://github.com/lib/pq)
-
SQLite: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
** 对于sqlite3的支持,你需要自己进行编译 `go build -tags sqlite3` 因为sqlite3需要cgo的支持。
### 命令列表
有如下可用的命令:
- **reverse** 反转一个数据库结构,生成代码
- **shell** 通用的数据库操作客户端,可对数据库结构和数据操作
- **dump** Dump数据库中所有结构和数据到标准输出
- **source** 从标注输入中执行SQL文件
- **driver** 列出所有支持的数据库驱动
### reverse
Reverse command is a tool to convert your database struct to all kinds languages of structs or classes. After you installed the tool, you can type
`xorm help reverse`
to get help
example:
sqlite:`xorm reverse sqite3 test.db templates/goxorm`
mysql:`xorm reverse mysql root:@/xorm_test?charset=utf8 templates/goxorm`
mymysql:`xorm reverse mymysql xorm_test2/root/ templates/goxorm`
postgres:`xorm reverse postgres "dbname=xorm_test sslmode=disable" templates/goxorm`
will generated go files in `./model` directory
### Template and Config
Now, xorm tool supports go and c++ two languages and have go, goxorm, c++ three of default templates. In template directory, we can put a config file to control how to generating.
~~~
lang=go
genJson=1
~~~
lang must be go or c++ now.genJson can be 1 or 0, if 1 then the struct will have json tag.
### Shell
Shell command provides a tool to operate database. For example, you can create table, alter table, insert data, delete data and etc.
`xorm shell sqlite3 test.db` will connect to the sqlite3 database and you can type `help` to list all the shell commands.
### Dump
Dump command provides a tool to dump all database structs and data as SQL to your standard output.
`xorm dump sqlite3 test.db` could dump sqlite3 database test.db to standard output. If you want to save to file, justtype `xorm dump sqlite3 test.db > test.sql`.
### Source
`xorm source sqlite3 test.db < test.sql` will execute sql file on the test.db.
### Driver
List all supported drivers since default build will not include sqlite3.
### LICENSE
BSD License [http://creativecommons.org/licenses/BSD/](http://creativecommons.org/licenses/BSD/)
xorm reverse mysql_xorm 工具相关推荐
- xorm reverse
xorm reverse 反向映射数据库表生成实体 安装go-xrom go get -u github.com/go-xorm/cmd/xorm 修改默认模板配置 进到 %GOPATH%src/gi ...
- 使用xorm工具,根据数据库自动生成 go 代码
引入 使用 golang 操作数据库的同学都会遇到一个问题 -- 根据数据表结构创建对应的 struct 模型.因为 golang 的使用首字母控制可见范围,我们经常要设计 struct 字段名和数据 ...
- mysql连接 xorm_golang 使用xorm操作mysql
xorm 官方介绍:xorm是一个简单而强大的Go语言ORM库. 通过它可以使数据库操作非常简便.xorm的目标并不是让你完全不去学习SQL,我们认为SQL并不会为ORM所替代,但是ORM将可以解决绝 ...
- 贝塞尔曲线工具css,如何反转CSS中的贝塞尔曲线的实现方法
首先来看一看我之前写的一个CSS轮播动画效果,为了让切换时动画的过渡更加的平滑我在animation-timing-function属性中并没有使用CSS提供的各种关键词,而使用了cubic-bezi ...
- Golang实践录:xorm使用记录
xorm使用记录.主要针对 mysql,也会涉及其它的. 技术总结 提供通用接口,适用于多种数据库,隐藏细节.但需要手动添加数据库驱动(Golang 本身亦如是). 可以用 Sync2 创建数据表,多 ...
- 夺旗赛 CTF 六大方向基础工具简介集合
一.MISC方向 杂项往往是不能被归到其他类别里的题目,所以什么样的题都有,工具也很杂. 主要的分类有: 1.视频音频图片类 Stegsolve.jar 一款图像隐写工具,支持使用不同方式解除图像隐写 ...
- CTF 六大方向基础工具合集
本文中提到的所有工具在ctf部落中均有,加入方式见文末. CTF 六大方向基础工具合集 今天来为大家分享CTF 六大方向基础工具简介集合. 一.MISC方向 杂项往往是不能被归到其他类别里的题目,所以 ...
- 夺旗赛 CTF 六大方向基础工具简介
一.MISC方向 杂项往往是不能被归到其他类别里的题目,所以什么样的题都有,工具也很杂. 主要的分类有: 1.视频音频图片类 Stegsolve.jar 一款图像隐写工具,支持使用不同方式解除图像隐写 ...
- 4-2 数据模型的生成
4-2 数据模型的生成 xorm使用可以查看:https://blog.csdn.net/INGNIGHT/article/details/104957116 cd github.com/go-xor ...
最新文章
- Openstack组建部署 — Environment of Controller Node
- Spring @scope注解
- Manjaro 17 搭建 redis 4.0.1 集群服务
- android模拟器与PC的端口映射(转)
- DeFi预言机Umbrella Network与BSC上去中心化杠杆交易协议WOWswap达成合作
- 中国速度袋行业市场供需与战略研究报告
- python卸载_如何为Python程序制作Windows安装包?
- Dropdownlist插入值!
- 【Cocos2dx】资源目录,播放背景音乐,导入外部库
- 10代cpu装win7_xp,win7,win8和win10哪个电脑系统最好用
- vivo android 刷机教程,vivo Xshot升级Android 4.4刷机教程
- jmail邮件服务器,jmail.smtpmail的核心代码:
- 电脑如何设置u盘启动,u盘启动项设置方法
- 手机查看企业qq邮件服务器,QQ企业邮箱怎么用?手机QQ邮箱收发邮件的方法
- Mac看电视直播(通过MUMU安卓模拟器+自定义直播软件apk)
- 数据结构与算法:B树(B-Tree)定义及搜索、插入、删除基本操作
- Discrete regularity for graph Laplacians --Jeff Calder 读书笔记 part1 待更
- 科技爱好者周刊(第 106 期):数字游民
- Java流程控制01-用户交互Scanner
- Matlab 版本对照
热门文章
- 用docker快速搭建chevereto图床
- 推荐一款拓展性高的开源仓库管理系统
- python 在日常工作中_每天在工作和生活中做的事,我如何用 Python 让它们变得更轻松?...
- 微信公众号开发--HTTP协议
- html微信公众平台,微信公众号平台.html
- 移动管家汽车tbox车联网终端多种车型共享汽车智能终端4G-TBOX车载硬件GPS分时租赁免破线
- 记一次去哈啰出行面试的经历
- 「3」线性代数(期末复习)
- ssm毕设项目民宿平台bwla1(java+VUE+Mybatis+Maven+Mysql+sprnig)
- 基于阿里云oss的文件管理系统