/xts

xts is a script that generates an insert statement or yaml from a mysql xml dump file.

Primary LanguageGoMIT LicenseMIT

xts

xts is a script that generates an insert statement or yaml from a mysql xml dump file.

Use case

xts is not a tool for restoring database.If your goal is to restore, you may want to refer to this.

xts is designed for tiny use cases such as the following.

  • In languages other than Go, MySQL dump files in xml format are used as fixtures for unit tests.
  • I want to reuse the above fixtures in unit tests for a project whose implementation language is Go.

Installation

Homebrew

$ brew install genkiroid/tap/xts

For other platforms

Precompiled binaries for released versions are available in the releases page.

go get

$ go get github.com/genkiroid/xts/...

Usage

Output insert statement to stdout

$ xts path-to-mysql-dump.xml

Output sql files for each table to specified directory

$ xts -d /tmp/ path-to-mysql-dump.xml

Output yaml to stdout

$ xts -y path-to-mysql-dump.xml

Output yaml files for each table to specified directory

$ xts -y -d /tmp/ path-to-mysql-dump.xml

Example is here.