watermill-sql
watermill-sql copied to clipboard
MySQL Binlog
Data mapping
In the current implementation of subscriber,
it is assumed that funtion UnmarshalMessage
(SchemaAdapter) is used to extract data from a row. However, in the case of binlog I found this function
unusable because of the parameter *sql.Row
. As a result I am inferring the content of columns based on separate configuration ColumnsMapping
. Such an approach is
inspired by go-mysql-elasticsearch.
Could you express your opinion on that? Can you suggest a better solution?
Database Access
In the current implementation of subscriber, database related interface is an argument passed to the constructor. As for as I can see, it does not make much sense in the case of a binlog subscriber.
In order to initialize the subscriber, a canal to database's binlog files needs to be created.
The initialization require credentials and details of the database (expressed in Database
struct)
this information is accessible only when explicitly passed to the subscriber which makes
beginner redundant.
Right now for simplicity I am using a hybrid solution, but it clearly needs correction. I would like to remove usage of the interface from the constructor and initialize the connection to the database myself. Could you express your opinion on that? Can you suggest a better solution?
TODO
- Add tests for data mapping:
mapRow
,getBytes
andgetNumber
. - Add tests for column mapping
ColumnsMapping
- Move and refactor
Row struct
- Refactor database access configuration (
Database
struct) - Add and improve comments
Hello @0michalsokolowski0! Thank you for this!
I'm tasked with porting parts of a legacy message driven application to go, in which mutating the status column (by the legacy parts) are significant events. Is this branch currently usable for early incorporation? Do you expect the it's public API is still going to change?
Hello @0michalsokolowski0! Thank you for this!
I'm tasked with porting parts of a legacy message driven application to go, in which mutating the status column (by the legacy parts) are significant events. Is this branch currently usable for early incorporation? Do you expect the it's public API is still going to change?
Hi @blaggacao ,
it is still work in progress and as I wrote above it needs to be tested more thoroughly.
Is this branch currently usable for early incorporation?
I don't think it is ready for usage.