Discover Packages
github.com/targetliu/xlsxtomysql
command
module
Version:
v0.1.2
Opens a new window with list of versions in this module.
Published: Sep 20, 2016
License: GPL-3.0
Opens a new window with license information.
Imports: 13
Opens a new window with list of imports.
Imported by: ? modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
README
README
¶
Excel(xlsx)导入MySQL数据库
简介
这是工作中用到的一个小工具,将Excel(xlsx)表导入MySQL表中,用Golang写的,每条记录单独一条 goroutine 处理,提高效率。支持随机数生成、密码生成、时间戳;支持关联查询、附表操作等。
使用方法
使用Go编译安装或直接下载:https://github.com/TargetLiu/xlsxtomysql/releases
使用命令: xlsxtomysql [DSN] [数据表名称] [*.xlsx]
更新
v0.1.2
修复bug
v0.1.1
修复bug,优化并发
DSN
格式:
[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]
示例:
root:123@tcp(127.0.0.1:3306)/dbname
注意:
Linux、Mac下可能需要输入 \( \)
Excel表导入结构说明
只支持单Sheet
第一行对应数据库表字段
内容行
:random 生成随机字符串
:time 当前unix时间戳
:null 空值,自动跳过该值,一般可用于自增id
如果该列为 password ,内容为[明文密码]或[明文密码|盐],盐可以通过[:字段名]获取之前的字段名。密码将自动根据字段名中填写的加密方式进行加密
如果该列为 other , 格式[表名|字段1|字段2|字段3....] 其它表需要按顺序为每个字段添加内容。字段可以为[:null|:id(主表生成的自增ID)|:random|:time]
Excel截图
关于作者
我的博客:http://targetliu.com/
GitHub:https://github.com/TargetLiu
Expand ▾
Collapse ▴
Documentation
¶
xlsxtomysql document
xlsxtomysql project main.go
Source Files
¶
Click to show internal directories.
Click to hide internal directories.