aboutsummaryrefslogtreecommitdiff
path: root/libbrep/common-traits.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-08-25 20:54:40 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-08-29 17:18:19 +0300
commit6613fbc2a3fc96b491b6691145c72c5a9550dc84 (patch)
treebb1116efb5b475608458038240a4ba80e32b99af /libbrep/common-traits.hxx
parent340cf0935a199240f6daaab8a347e22172f4d15b (diff)
Add target to build configuration id
Diffstat (limited to 'libbrep/common-traits.hxx')
-rw-r--r--libbrep/common-traits.hxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/libbrep/common-traits.hxx b/libbrep/common-traits.hxx
index 99e8f3e..141a738 100644
--- a/libbrep/common-traits.hxx
+++ b/libbrep/common-traits.hxx
@@ -10,12 +10,50 @@
#include <odb/pgsql/traits.hxx>
+#include <libbutl/target-triplet.hxx>
+
#include <libbpkg/package-name.hxx>
namespace odb
{
namespace pgsql
{
+ // target_triplet
+ //
+ template <>
+ class value_traits<butl::target_triplet, id_string>:
+ value_traits<std::string, id_string>
+ {
+ public:
+ using value_type = butl::target_triplet;
+ using query_type = butl::target_triplet;
+ using image_type = details::buffer;
+
+ using base_type = value_traits<std::string, id_string>;
+
+ static void
+ set_value (value_type& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ std::string s;
+ base_type::set_value (s, b, n, is_null);
+ v = !s.empty () ? value_type (s) : value_type ();
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const value_type& v)
+ {
+ base_type::set_image (b, n, is_null, v.string ());
+ }
+ };
+
+ // package_name
+ //
template <>
class value_traits<bpkg::package_name, id_string>:
value_traits<std::string, id_string>