1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#pragma once
#include <util/generic/string.h>
#include <util/generic/hash.h>
namespace NSQLComplete {
enum class EObjectKind {
Folder,
Table,
};
enum class ENodeKind {
Any,
Table,
};
struct TTableId {
TString Cluster;
TString Path;
friend bool operator<(const TTableId& lhs, const TTableId& rhs);
friend bool operator==(const TTableId& lhs, const TTableId& rhs) = default;
};
template <class T>
requires std::regular<T> &&
requires(T x) { {x < x} -> std::convertible_to<bool>; }
struct TAliased: T {
TString Alias;
TAliased(TString alias, T value)
: T(std::move(value))
, Alias(std::move(alias))
{
}
TAliased(T value)
: T(std::move(value))
{
}
friend bool operator<(const TAliased& lhs, const TAliased& rhs) {
return std::tie(lhs.Alias, static_cast<const T&>(lhs)) < std::tie(rhs.Alias, static_cast<const T&>(rhs));
}
friend bool operator==(const TAliased& lhs, const TAliased& rhs) = default;
};
struct TColumnId {
TString TableAlias;
TString Name;
friend bool operator<(const TColumnId& lhs, const TColumnId& rhs);
friend bool operator==(const TColumnId& lhs, const TColumnId& rhs) = default;
};
} // namespace NSQLComplete
template <>
struct THash<NSQLComplete::TTableId> {
inline size_t operator()(const NSQLComplete::TTableId& x) const {
return THash<std::tuple<TString, TString>>()(std::tie(x.Cluster, x.Path));
}
};
|