Categorygithub.com/jayecc/mysql2md
modulepackage
0.0.0-20240701081224-b7c91aad3b37
Repository: https://github.com/jayecc/mysql2md.git
Documentation: pkg.go.dev

# README

Mysql to markdown

This is a simple tool to convert mysql database to markdown.

Install

go install github.com/jayecc/mysql2md@latest

Usage

$ ./mysql2md -h
Usage of mysql2md:
  -ddl                                                                                                                                            
        generate ddl info (default false)                                                                                                         
  -dir string                                                                                                                                     
        directory to save the file (default "./output")                                                                                           
  -dsn string                                                                                                                                     
        database connection string (default "username:password@tcp(localhost:3306)/database?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s")
  -whole                                                                                                                                          
        generate whole file (default false)

Example

  • Build file contains DDL and define the output directory
mysql2md -dsn 'root:password@tcp(localhost:3306)/test?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s' -whole -ddl -dir=.
  • Build file contains DDL
mysql2md -dsn 'root:password@tcp(localhost:3306)/test?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s' -whole -ddl
  • Build multiple files with DDL
mysql2md -dsn 'root:password@tcp(localhost:3306)/test?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s' -ddl
  • Build multiple files without DDL
mysql2md -dsn 'root:password@tcp(localhost:3306)/test?charset=utf8mb4&parseTime=True&loc=Local&timeout=10s'

test tables list

NameEngineCreate_timeCollationComment
memberInnoDB2023-11-13T16:16:52+08:00utf8mb4_general_ci账户信息

test.member

账户信息

COLUMNS

COLUMN_NAMECOLUMN_DEFAULTIS_NULLABLECOLLATION_NAMECOLUMN_TYPECOLUMN_KEYEXTRACOLUMN_COMMENT
idNOint(10) unsignedPRIauto_increment``
nicknameNOutf8mb4_general_civarchar(30)MUL昵称

DDL

CREATE TABLE `member` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nickname` varchar(30) NOT NULL COMMENT '昵称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='账户信息'

License

MIT

# Structs

No description provided by the author
No description provided by the author
No description provided by the author