package
1.1.0
Repository: https://github.com/compose/transporter.git
Documentation: pkg.go.dev

# README

MySQL adaptor

Using the adaptor

You need to specify a sink and source like so:

var source = mysql({
  "uri": "mysql://user:[email protected]:11111/database?ssl=custom",
  "tail": true,
  "cacert": "/path/to/source.crt",
})

var sink = mysql({
  "uri": "mysql://user:[email protected]:22222/database?ssl=custom",
  "cacert": "/path/to/sink.crt",
  "servername": "sink.host.com",
})

t.Source("source", source, "/.*/").Save("sink", sink, "/.*/")
  • tailing is optional and only makes sense on the source
  • For TLS you can use ssl=true which does unverified TLS or ssl=custom in which case you need to supply the cacert.
  • You don't need to supply the servername, but if you do the certificate will be verified against it

Requirements

  • The source must allow the connecting user to query the binlog
  • Per Postgresql you need to create the sink/destination table structure first

Limitations

  • Note that per the Postgresql adaptor this probably isn't very performant at copying huge databases as there is no bulk option yet.
  • Has only been developed and tested using MySQL as the sink and source. Unsure how it will function when combined with other adaptors.

# Functions

NewClient creates a default file client.
WithCustomTLS configures the RootCAs for the underlying TLS connection.
WithURI defines the full connection string for the MySQL connection Make this handle the different DSNs for these two? - https://github.com/go-sql-driver/mysql#dsn-data-source-name - https://github.com/go-mysql-org/go-mysql#driver.

# Constants

DefaultURI is the default endpoint of MySQL on the local machine.

# Structs

Client represents a client to the underlying File source.
Reader implements the behaviour defined by client.Reader for interfacing with MySQL.
Session serves as a wrapper for the underlying *sql.DB.
Tailer implements the behaviour defined by client.Tailer for interfacing with the MySQL binlog.
Writer implements client.Writer for use with MySQL.

# Type aliases

ClientOptionFunc is a function that configures a Client.