Skip to main content

Module decoding

Module decoding 

Source

ConstantsΒ§

MYSQL_MAX_FRACTIONAL_PRECISION πŸ”’
Maximum fractional-seconds precision MySQL accepts for DATETIME(p) and TIMESTAMP(p) β€” values are stored in microseconds, so 6 digits is the upper bound (https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html).
MYSQL_ZERO_TIMESTAMP πŸ”’
Canonical text for the MySQL zero-date sentinel (β€˜0000-00-00 00:00:00’). In binlog MYSQL_TYPE_DATETIME/MYSQL_TYPE_DATETIME2 encodings, sec=0 cannot represent unix epoch 0. The TIMESTAMP type’s supported range starts at β€˜1970-01-01 00:00:01’ UTC (https://dev.mysql.com/doc/refman/8.0/en/datetime.html), so any sec=0 is unambiguously this sentinel.

FunctionsΒ§

check_char_length πŸ”’
decode_error πŸ”’
Build a ValueDecodeError, logging the schema, table, column, source gtid_set (if any), and a shape description of row at the same time. The shape string is only built here β€” pack_mysql_row’s happy path does no per-row allocation beyond what decoding requires.
describe_row_shape πŸ”’
Describes the structural shape of a row without revealing any data values. Iterates every wire column. For each, emits the wire name, the binlog wire type, the character-set id (or binary), a classification relative to table_desc (expected=<scalar> for active columns, ignored for columns excluded from the source, extra for upstream columns with no descriptor entry), and a value disposition (null or bytes(len=N) / primitive kind). Intended for diagnostic logging on decode errors: MySQL serializes CHAR, VARCHAR, TEXT, JSON, BLOB, etc. all as Value::Bytes, so the wire type tag and the expected scalar type are what distinguish them.
format_mysql_timestamp πŸ”’
Format MySQL DATETIME/TIMESTAMP components as YYYY-MM-DD HH:MM:SS[.ffff]. micros is the raw microseconds (0..1_000_000); only the leading precision digits are kept, matching MySQL’s DATETIME(p)/TIMESTAMP(p) display.
mysql_zero_timestamp πŸ”’
Format the zero-date sentinel for a column with the given fractional precision (matches the Date arm’s {:0precision$} behavior).
pack_mysql_row
pack_val_as_datum πŸ”’