Converters
Any type from PostgreSQL can be converted using converter objects. By default, Clear converts already the main type of PostgreSQL.
However, custom type may not be supported yet. Clear offers you the possibility to add a custom converter.
Declare a new converter
The example below with a converter for a Color
structure should be straight-forward:
Then you can use your mapped type in your model:
converter
option
converter
optionOptionally, you may want to use a converter which is not related to the type itself. To do so, you can pass the converter name as optional argument in the column
declaration:
By convention, converters which map struct and class directly are named using CamelCase, while converters which are not automatic should be named using the underscore notation.
Last updated