aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/complete/core/name.cpp
blob: 22ff843cb26e82ba31cdad66532166398970ae24 (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
#include "name.h"

#include <util/stream/output.h>

namespace NSQLComplete {

    bool operator<(const TTableId& lhs, const TTableId& rhs) {
        return std::tie(lhs.Cluster, lhs.Path) < std::tie(rhs.Cluster, rhs.Path);
    }

} // namespace NSQLComplete

template <>
void Out<NSQLComplete::TTableId>(IOutputStream& out, const NSQLComplete::TTableId& value) {
    out << value.Cluster << ".`" << value.Path << "`";
}

template <>
void Out<NSQLComplete::TAliased<NSQLComplete::TTableId>>(IOutputStream& out, const NSQLComplete::TAliased<NSQLComplete::TTableId>& value) {
    Out<NSQLComplete::TTableId>(out, value);
    out << " AS " << value.Alias;
}

template <>
void Out<NSQLComplete::TColumnId>(IOutputStream& out, const NSQLComplete::TColumnId& value) {
    out << value.TableAlias << "." << value.Name;
}