Documentation ¶
Index ¶
- type Config
- type CreateDb
- type CreateTable
- type DbConfig
- type Mysqldump
- func (md *Mysqldump) Close() error
- func (md *Mysqldump) Export() (outFile string, err error)
- func (md *Mysqldump) ExportData(w io.Writer, tableName string) (err error)
- func (md *Mysqldump) GetCreateDbSQL() (string, error)
- func (md *Mysqldump) GetCreateTableSQL(tableName string) (string, error)
- func (md *Mysqldump) GetRootDir() string
- func (md *Mysqldump) Import(sqlPath ...string) (err error)
- func (md *Mysqldump) OpenMysql() error
- func (md *Mysqldump) SelectTableNames() (tables []string, err error)
- type TPLModel
- type TPLSqlModel
- type TableColumn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Debug bool // 是否调试模式 IsExportData bool // 是否导出数据 ExportDataStep int64 // 导出数据时,每次查询数据量 IsCreateDB bool // 是否生成建库语句 OutPath string // 输出sql文件目录-绝对路径-用于导出 SQLPath string // 导入的sql文件-绝对路径-用于导入 OutZip bool // 是否导出zip压缩文件 DbCfg *DbConfig // 数据库连接信息 }
Config 导出sql所需的配置信息
type CreateDb ¶
type CreateDb struct { Database string `xorm:"'Database'"` CreateDatabase string `xorm:"'Create Database'"` }
CreateDb 创建数据库 sql查询
type CreateTable ¶
type CreateTable struct { Table string `xorm:"'Table'"` CreateTable string `xorm:"'Create Table'"` }
CreateTable 创建table sql查询
type DbConfig ¶
type DbConfig struct { Address string // 数据库连接地址 Port int // 数据库端口 User string // 数据库用户名 Passwd string // 数据库密码 DbName string // 数据库名 }
DbConfig 数据库连接配置
type Mysqldump ¶
type Mysqldump struct {
// contains filtered or unexported fields
}
Mysqldump mysql导出数据对象
func (*Mysqldump) ExportData ¶
ExportData 导出数据为
func (*Mysqldump) GetCreateDbSQL ¶
GetCreateDbSQL 获取创建数据库
func (*Mysqldump) GetCreateTableSQL ¶
GetCreateTableSQL 查询创建表语句
func (*Mysqldump) GetRootDir ¶
GetRootDir 获取程序跟目录,返回值尾部包含'/'
func (*Mysqldump) SelectTableNames ¶
SelectTableNames 查询数据库表列表
type TPLModel ¶
type TPLModel struct { MySQL *DbConfig SQL []*TPLSqlModel Date string }
TPLModel 导出数据结构体
type TPLSqlModel ¶
type TPLSqlModel struct { TableName string // 表名 CreateSQL string // 创建表sql语句 InsertSQL string // 插入数据sql语句 }
TPLSqlModel 导出数据sql部分
Click to show internal directories.
Click to hide internal directories.