updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
d8d86f3f0c
commit
88718de96e
@ -42,6 +42,8 @@ public:
|
||||
|
||||
[[nodiscard]] auto limit(std::int32_t value) -> db_select_op_t;
|
||||
|
||||
[[nodiscard]] auto offset(std::int32_t value) -> db_select_op_t;
|
||||
|
||||
[[nodiscard]] auto order_by(std::string column_name,
|
||||
bool ascending) -> db_select_op_t;
|
||||
};
|
||||
@ -56,6 +58,7 @@ public:
|
||||
|
||||
std::vector<std::string> group_by;
|
||||
std::optional<std::int32_t> limit;
|
||||
std::optional<std::int32_t> offset;
|
||||
std::optional<std::pair<std::string, bool>> order_by;
|
||||
std::optional<w_t> where;
|
||||
std::map<std::size_t, std::vector<w_t::action_t>> where_actions;
|
||||
@ -92,6 +95,8 @@ public:
|
||||
|
||||
[[nodiscard]] auto limit(std::int32_t value) -> db_select &;
|
||||
|
||||
[[nodiscard]] auto offset(std::int32_t value) -> db_select &;
|
||||
|
||||
[[nodiscard]] auto order_by(std::string column_name,
|
||||
bool ascending) -> db_select &;
|
||||
|
||||
|
@ -29,6 +29,7 @@ void db_select::context::clear() {
|
||||
columns.clear();
|
||||
count_columns.clear();
|
||||
limit.reset();
|
||||
offset.reset();
|
||||
order_by.reset();
|
||||
where.reset();
|
||||
where_values.clear();
|
||||
@ -54,6 +55,12 @@ auto db_select::context::db_select_op_t::limit(std::int32_t value)
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto db_select::context::db_select_op_t::offset(std::int32_t value)
|
||||
-> db_select::context::db_select_op_t {
|
||||
db_select{ctx}.offset(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto db_select::context::db_select_op_t::order_by(std::string column_name,
|
||||
bool ascending)
|
||||
-> db_select::context::db_select_op_t {
|
||||
@ -127,6 +134,10 @@ auto db_select::dump() const -> std::string {
|
||||
query << " LIMIT " << context_->limit.value();
|
||||
}
|
||||
|
||||
if (context_->offset.has_value()) {
|
||||
query << " OFFSET " << context_->offset.value();
|
||||
}
|
||||
|
||||
query << ';';
|
||||
|
||||
return query.str();
|
||||
@ -185,6 +196,11 @@ auto db_select::limit(std::int32_t value) -> db_select & {
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto db_select::offset(std::int32_t value) -> db_select & {
|
||||
context_->offset = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
auto db_select::order_by(std::string column_name,
|
||||
bool ascending) -> db_select & {
|
||||
context_->order_by = {column_name, ascending};
|
||||
|
Loading…
x
Reference in New Issue
Block a user