LeechCraft  0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
pgimpl.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include "oraltypes.h"
12 
14 {
15  struct ImplFactory
16  {
17  using IsImpl_t = void;
18 
19  struct TypeLits
20  {
21  inline constexpr static CtString IntAutoincrement { "SERIAL PRIMARY KEY" };
22  inline constexpr static CtString Binary { "BYTEA" };
23  };
24 
25  inline constexpr static CtString LimitNone { "ALL" };
26 
27  constexpr static auto GetInsertPrefix (auto)
28  {
29  return "INSERT"_ct;
30  }
31 
32  constexpr static auto GetInsertSuffix (InsertAction::DefaultTag)
33  {
34  return ""_ct;
35  }
36 
37  constexpr static auto GetInsertSuffix (InsertAction::IgnoreTag)
38  {
39  return "ON CONFLICT DO NOTHING"_ct;
40  }
41 
42  constexpr static auto GetInsertSuffix (InsertAction::Replace, auto conflictingFields, auto allFields)
43  {
44  return "ON CONFLICT (" + JoinTup (conflictingFields, ", ") +
45  ") DO UPDATE SET " + JoinTup (ZipWith (allFields, " = EXCLUDED.", allFields), ", ");
46  }
47  };
48 }
49 
50 namespace LC::Util::oral
51 {
53 }
constexpr auto JoinTup(auto &&stringsTuple, auto &&sep) noexcept
Definition: ctstringutils.h:29
static constexpr auto GetInsertSuffix(InsertAction::Replace, auto conflictingFields, auto allFields)
Definition: pgimpl.h:42
static constexpr auto GetInsertPrefix(auto)
Definition: pgimpl.h:27
static constexpr auto GetInsertSuffix(InsertAction::DefaultTag)
Definition: pgimpl.h:32
auto ZipWith(const Container< T1 > &c1, const Container< T2 > &c2, F f) -> WrapType_t< Container< std::decay_t< std::result_of_t< F(T1, T2)>>>>
Definition: prelude.h:37
static constexpr auto GetInsertSuffix(InsertAction::IgnoreTag)
Definition: pgimpl.h:37