MySQL表结构生成Markdown文档

MySQL表结构生成Markdown文档

一、mysql_markdown

mysql_markdown 是一款基于 go 语言编写的一个命令行工具,适用于 Linux、Mac、Windows等平台。

1.1、安装

unix

curl -o /usr/local/bin/mysql_markdown -sSL https://raw.githubusercontent.com/alicfeng/mysql_markdown/master/release/mysql_markdown_unix
chmod +x /usr/local/bin/mysql_markdown

mac

curl -o /usr/local/bin/mysql_markdown -sSL https://raw.githubusercontent.com/alicfeng/mysql_markdown/master/release/mysql_markdown_mac
chmod +x /usr/local/bin/mysql_markdown

other

git clone https://github.com/alicfeng/mysql_markdown.git
cd mysql_markdown
go get "github.com/go-sql-driver/mysql"
go build -o /usr/local/bin/mysql_markdown mysql_markdown.go
chmod +x /usr/local/bin/mysql_markdown

1.2、使用

# 帮助函数
➜  mysql_markdown -h
flag needs an argument: -h
Usage: mysql_markdown [options...]
--help  This help text
-h      host.     default 127.0.0.1
-u      username. default root
-p      password. default root
-d      database. default mysql
-P      port.     default 3306
-c      charset.  default utf8
-o      output.   default current location

# 简单使用
➜ mysql_markdown -p samego -d samego
mysql connected ...
1/8 the demo table is making ...
2/8 the failed_jobs table is making ...
3/8 the migrations table is making ...
4/8 the password_resets table is making ...
5/8 the roles table is making ...
6/8 the user table is making ...
7/8 the userinfo table is making ...
8/8 the users table is making ...
mysql_markdown finished ...

二、mysql_to_md

Java 语言工具:mysql_to_md

2.1、使用

配置数据库连接(目前只支持mysql),直接启动即可。
配置项:

exclude.table:排除的表名,多个以","(英文逗号)隔开
appoint.table:指定要生产的表名,多个以","(英文逗号)隔开
exclude.field:排除要生成的字段,多个以","(英文逗号)隔开
目前支持字段:fieldName(字段名),fieldExplain(字段说明),fieldType(字段类型),defaultValue(默认值),isEmpty(是否为空)
file.path:生成的文件名称及地址,默认"d:\数据库文档(xx年xx月xx日xx时xx).md"

评论

暂无

添加新评论