win7下使用go语言编写的mysql_markdown生成数据库markdown文档

一、Go语言安装

1、 go语言下载

    下载地址:https://golang.google.cn/dl/

       

 

 

2、go语言配置

   ① 配置GoRoot路径

          

     ②配置Path路径

         

    ③配置Go程序工作目录GOPATH

       

       配置完成以上环境变量后,我们可以在命令行窗口中查看配置是否成功

       

   ④在GOPATH配置的工作目录中新建main.go文件,编写如下代码

 

 

    

package main 

import (
  "fmt"
)

func main() {
  fmt.Println("Hello Go!");
}

  ⑤编译main.go文件后会生成main.exe文件

   

 

 

   ⑥执行main.exe文件,程序成功输出Hello Go!

   

 

 

   ⑦开启go modules功能

  go env -w GO111MODULE=auto

 

3、常见问题

  ①未切换国内源

 

 

二、使用mysql_markdown生成数据库说明文档

git clone https://github.com/alicfeng/mysql_markdown.git
cd mysql_markdown
go get "github.com/go-sql-driver/mysql"//go连接数据库扩展
go build -o E:\mysql_markdown mysql_markdown.go//编译生成mysql_markdown.exe
chmod +x E:\mysql_markdown
./mysql_markdown.exe -h 数据库地址 -p 密码 -d数据库名称


# 帮助函数
➜  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 ...

 

 

posted @ 2022-07-11 15:49  ryan377  阅读(209)  评论(0)    收藏  举报