utils

package
v1.5.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpExport 导出操作
	OpExport string = `export`
	// OpImport 导入操作
	OpImport string = `import`
)
View Source
const (
	Importor = `mysql`
	Exportor = `mysqldump`
)

Variables

View Source
var Charsets = []string{
	"armscii8",
	"ascii",
	"big5",
	"binary",
	"cp1250",
	"cp1251",
	"cp1256",
	"cp1257",
	"cp850",
	"cp852",
	"cp866",
	"cp932",
	"dec8",
	"eucjpms",
	"euckr",
	"gb18030",
	"gb2312",
	"gbk",
	"geostd8",
	"greek",
	"hebrew",
	"hp8",
	"keybcs2",
	"koi8r",
	"koi8u",
	"latin1",
	"latin2",
	"latin5",
	"latin7",
	"macce",
	"macroman",
	"sjis",
	"swe7",
	"tis620",
	"ucs2",
	"ujis",
	"utf16",
	"utf16le",
	"utf32",
	"utf8",
	"utf8mb3",
	"utf8mb4",
}

Charsets MySQL 支持的字符集

View Source
var MySQLBinPaths = []string{`/usr/local/bin`, `/usr/bin`}

Functions

func Export

func Export(ctx context.Context, noticer notice.Noticer,
	cfg *driver.DbAuth, tables []string, structWriter, dataWriter interface{},
	mysqlVersion string, hasGTID bool, resetAutoIncrements ...bool) error

Export 导出SQL文件

func Import

func Import(ctx context.Context, noticer *notice.NoticeAndProgress, cfg *driver.DbAuth, cacheDir string, files []string) error

Import 导入SQL文件

func RemoveAutoIncrementValue added in v0.8.1

func RemoveAutoIncrementValue(s string) string

RemoveAutoIncrementValue AUTO_INCREMENT值

func ResetAutoIncrement

func ResetAutoIncrement(sqlStructFile string) error

ResetAutoIncrement 重置AUTO_INCREMENT值为0

func SupportedExport added in v0.8.1

func SupportedExport() bool

func SupportedImport added in v1.3.3

func SupportedImport() bool

Types

type FileInfo

type FileInfo struct {
	Start      time.Time
	End        time.Time
	Elapsed    time.Duration
	Path       string
	Size       int64
	Compressed bool
	Error      string `json:",omitempty"`
}

FileInfo 文件信息

type FileInfos

type FileInfos []*FileInfo

FileInfos 文件信息集合

func (*FileInfos) Add added in v1.1.1

func (f *FileInfos) Add(fi *FileInfo)

type ImportFile added in v1.3.3

type ImportFile struct {
	StructFiles []string
	DataFiles   []string
	// contains filtered or unexported fields
}

func ParseImportFile added in v1.3.3

func ParseImportFile(cacheDir string, files []string) (*ImportFile, error)

func (*ImportFile) AllSqlFileNum added in v1.3.3

func (a *ImportFile) AllSqlFileNum() int

func (*ImportFile) AllSqlFiles added in v1.3.3

func (a *ImportFile) AllSqlFiles() []string

func (*ImportFile) Close added in v1.3.3

func (a *ImportFile) Close() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL