[odb-users] Alternate mapping of bool

Paul Stath PStath at jmawireless.com
Thu Apr 5 16:55:01 EDT 2018


Hi Boris,

Is there a way to provide a custom mapping for bool and have it only override certain columns in the object?

I need to have a bool column where a True value is (NOT NULL), and a False value is NULL.
This column will be used in a unique index where multiple rows can have the same index values, but only one row can be active (True).

I would like other bool columns in the object to have the default ODB mapping when False = 0 and True = 1.

Is there a simpler way than creating a "wrapper" object, something similar to:

struct NullBool {
               bool       value;
}

and then provide:
template<>
class value_trait<NullBool, id_test>
{
...
}

Please steer me in the right direction.

--- Paul


More information about the odb-users mailing list