diff --git a/include/sqlpp11/value_or_null.h b/include/sqlpp11/value_or_null.h index 0643d5ad..788f1899 100644 --- a/include/sqlpp11/value_or_null.h +++ b/include/sqlpp11/value_or_null.h @@ -52,6 +52,27 @@ namespace sqlpp bool _is_null; }; + template + struct serializer_t> + { + using _serialize_check = consistent_t; + using Operand = value_or_null_t; + + static Context& _(const Operand& t, Context& context) + { + if (t._is_null) + { + context << "NULL"; + } + else + { + serialize(wrap_operand_t{t._value}, context); + } + + return context; + } + }; + template auto value_or_null(T t) -> value_or_null_t>> {