LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
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{
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
50namespace LC::Util::oral
51{
53}
detail::PostgreSQL::ImplFactory PostgreSQLImplFactory
Definition pgimpl.h:52
constexpr auto ZipWith(Tup1 &&tup1, auto &&sep, Tup2 &&tup2) noexcept
constexpr auto JoinTup(auto &&stringsTuple, auto &&sep) noexcept
static constexpr CtString LimitNone
Definition pgimpl.h:25
static constexpr auto GetInsertPrefix(auto)
Definition pgimpl.h:27
static constexpr auto GetInsertSuffix(InsertAction::DefaultTag)
Definition pgimpl.h:32
static constexpr auto GetInsertSuffix(InsertAction::IgnoreTag)
Definition pgimpl.h:37
static constexpr auto GetInsertSuffix(InsertAction::Replace, auto conflictingFields, auto allFields)
Definition pgimpl.h:42