Closed Blacksmoke16 closed 5 years ago
No there is not.
The best I can say today is to check https://github.com/crystal-lang/crystal-mysql/blob/master/src/mysql/types.cr . The decl_type
macro declares a struct that write/read (binary protocol)/parse (text protocol) values from the connection.
MySql::Type
are grabbed by the column type id and those are stored in a class variable hash. That is filled by the decl_type
directly. Later included types should override previous ones since code should be run in order.
Here is an example to transparently encode/decode the UUID type to MySQL: https://github.com/ysbaddaden/rome/blob/master/src/mysql_ext.cr
Are there any docs on how to register a custom decoder, similar to the PG adapter shard? Or is that not a thing?
Use case being wanting to control how a custom type gets saved and read from db.