blob: e31464d420dbfd6807d7cf69745d3828655c2b02 (
plain) (
blame)
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
|
#pragma once
#include <yql/essentials/sql/v1/ide/completion/name/object/simple/schema.h>
#include <yql/essentials/sql/v1/ide/completion/name/cache/byte_size.h>
#include <util/generic/string.h>
#include <util/generic/hash.h>
namespace NSQLComplete {
struct TSchemaDescribeCacheKey {
TString Zone;
TString Cluster;
TString Path;
friend bool operator==(
const TSchemaDescribeCacheKey& lhs,
const TSchemaDescribeCacheKey& rhs) = default;
};
template <>
struct TByteSize<TSchemaDescribeCacheKey> {
size_t operator()(const TSchemaDescribeCacheKey& x) const noexcept {
return sizeof(x) +
TByteSize<TString>()(x.Zone) +
TByteSize<TString>()(x.Cluster) +
TByteSize<TString>()(x.Path);
}
};
template <>
struct TByteSize<TFolderEntry> {
size_t operator()(const TFolderEntry& x) const noexcept {
return sizeof(x) +
TByteSize<TString>()(x.Type) +
TByteSize<TString>()(x.Name);
}
};
template <>
struct TByteSize<TTableDetails> {
size_t operator()(const TTableDetails& x) const noexcept {
return TByteSize<TVector<TString>>()(x.Columns);
}
};
} // namespace NSQLComplete
template <>
struct THash<NSQLComplete::TSchemaDescribeCacheKey> {
inline size_t operator()(const NSQLComplete::TSchemaDescribeCacheKey& key) const {
return THash<std::tuple<TString, TString, TString>>()(
std::tie(key.Zone, key.Cluster, key.Path));
}
};
|