File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,17 @@ struct Parser<boost::uuids::uuid> {
3838
3939} // namespace sqlgen::parsing
4040
41+ namespace sqlgen ::transpilation {
42+
43+ template <>
44+ struct ToValue <boost::uuids::uuid> {
45+ dynamic::Value operator ()(const boost::uuids::uuid& _u) const {
46+ return dynamic::Value{dynamic::String{.val = boost::uuids::to_string (_u)}};
47+ }
48+ };
49+
50+ } // namespace sqlgen::transpilation
51+
4152// / For the JSON serialization - not needed for
4253// / the actual DB operations.
4354namespace rfl {
@@ -87,10 +98,10 @@ TEST(mysql, test_dynamic_type) {
8798
8899 const auto people2 = sqlgen::write (conn, people1)
89100 .and_then (sqlgen::read<std::vector<Person>> |
90- order_by ( " age " _c. desc ()))
101+ where ( " id " _c == people1. front (). id ()))
91102 .value ();
92103
93- const auto json1 = rfl::json::write (people1);
104+ const auto json1 = rfl::json::write (std::vector<Person>({ people1. front ()}) );
94105 const auto json2 = rfl::json::write (people2);
95106
96107 EXPECT_EQ (json1, json2);
Original file line number Diff line number Diff line change @@ -38,6 +38,17 @@ struct Parser<boost::uuids::uuid> {
3838
3939} // namespace sqlgen::parsing
4040
41+ namespace sqlgen ::transpilation {
42+
43+ template <>
44+ struct ToValue <boost::uuids::uuid> {
45+ dynamic::Value operator ()(const boost::uuids::uuid& _u) const {
46+ return dynamic::Value{dynamic::String{.val = boost::uuids::to_string (_u)}};
47+ }
48+ };
49+
50+ } // namespace sqlgen::transpilation
51+
4152// / For the JSON serialization - not needed for
4253// / the actual DB operations.
4354namespace rfl {
@@ -87,10 +98,10 @@ TEST(postgres, test_dynamic_type) {
8798
8899 const auto people2 = sqlgen::write (conn, people1)
89100 .and_then (sqlgen::read<std::vector<Person>> |
90- order_by ( " age " _c. desc ()))
101+ where ( " id " _c == people1. front (). id ()))
91102 .value ();
92103
93- const auto json1 = rfl::json::write (people1);
104+ const auto json1 = rfl::json::write (std::vector<Person>({ people1. front ()}) );
94105 const auto json2 = rfl::json::write (people2);
95106
96107 EXPECT_EQ (json1, json2);
You can’t perform that action at this time.
0 commit comments