rust_mysql_common icon indicating copy to clipboard operation
rust_mysql_common copied to clipboard

get JSON representation of binlog's WriteRowsEvent

Open docteurklein opened this issue 3 years ago • 2 comments

Hello :)

I'm trying to push mysql binlog events into a postgres table (weird, I know :)). To do that I'd like to get a JSON representation of the before and after values.

Here is the current code: https://github.com/docteurklein/pgpim/blob/master/rust/src/main.rs#L74 Any idea how to do that? I wonder if impl TryFrom<BinlogRow> for Row would do the trick, since Row seems to be serializable in json? If so, how would you use this API?

Thanks for reading :)

docteurklein avatar Jun 16 '22 12:06 docteurklein

Hi.

It's unclear which layout will be convenient. I'd suggest you to write your own to_json and from_json functions.

blackbeam avatar Jun 16 '22 13:06 blackbeam

Thanks for the fast answer :) I'm quite inexperienced in rust, any hint or example to point me to?

docteurklein avatar Jun 18 '22 07:06 docteurklein