YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/yql/pggate/pg_table.h
Line
Count
Source
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
//
13
14
#ifndef YB_YQL_PGGATE_PG_TABLE_H
15
#define YB_YQL_PGGATE_PG_TABLE_H
16
17
#include "yb/yql/pggate/pg_gate_fwd.h"
18
#include "yb/yql/pggate/pg_tabledesc.h"
19
20
namespace yb {
21
namespace pggate {
22
23
class PgTable {
24
 public:
25
5.68M
  PgTable() = default;
26
  explicit PgTable(const PgTableDescPtr& desc);
27
28
1.43M
  bool operator!() const {
29
1.43M
    return !desc_;
30
1.43M
  }
31
32
7.54M
  explicit operator bool() const {
33
7.54M
    return desc_ != nullptr;
34
7.54M
  }
35
36
8.62M
  PgTableDesc* operator->() const {
37
8.62M
    return desc_.get();
38
8.62M
  }
39
40
8.69M
  PgTableDesc& operator*() const {
41
8.69M
    return *desc_;
42
8.69M
  }
43
44
8.37M
  std::vector<PgColumn>& columns() {
45
8.37M
    return *columns_;
46
8.37M
  }
47
48
  Result<PgColumn&> ColumnForAttr(int attr_num);
49
  PgColumn& ColumnForIndex(size_t index);
50
51
 private:
52
  PgTableDescPtr desc_;
53
  std::shared_ptr<std::vector<PgColumn>> columns_;
54
};
55
56
}  // namespace pggate
57
}  // namespace yb
58
59
#endif  // YB_YQL_PGGATE_PG_TABLE_H