updated build system

This commit is contained in:
2024-10-10 15:07:46 -05:00
parent 1f4872769d
commit ba2850ea21
6 changed files with 141 additions and 22 deletions

View File

@ -31,17 +31,23 @@ namespace repertory::utils::db::sqlite {
class db_delete final {
public:
struct context final : db_context_t {
struct db_delete_op_t final {
std::shared_ptr<context> ctx;
[[nodiscard]] auto dump() const -> std::string;
[[nodiscard]] auto go() const -> db_result<context>;
};
context(sqlite3 &db3_, std::string table_name_)
: db_context_t(db3_, table_name_) {}
using w_t = db_where_t<context, db_delete>;
using w_t = db_where_t<context, db_delete_op_t>;
std::optional<w_t> where;
std::vector<db_types_t> where_values;
void clear() {
where.reset();
where_values.clear();
}
void clear();
};
using row = db_row<context>;

View File

@ -31,26 +31,36 @@ namespace repertory::utils::db::sqlite {
class db_select final {
public:
struct context final : db_context_t {
struct db_select_op_t final {
std::shared_ptr<context> ctx;
[[nodiscard]] auto dump() const -> std::string;
[[nodiscard]] auto go() const -> db_result<context>;
[[nodiscard]] auto group_by(std::string column_name) -> db_select_op_t;
[[nodiscard]] auto limit(std::int32_t value) -> db_select_op_t;
[[nodiscard]] auto order_by(std::string column_name,
bool ascending) -> db_select_op_t;
};
context(sqlite3 &db3_, std::string table_name_)
: db_context_t(db3_, table_name_) {}
using w_t = db_where_t<context, db_select>;
using w_t = db_where_t<context, db_select_op_t>;
std::vector<std::string> columns;
std::map<std::string, std::string> count_columns;
std::vector<std::string> group_by;
std::optional<std::int32_t> limit;
std::optional<std::pair<std::string, bool>> order_by;
std::optional<w_t> where;
std::vector<db_types_t> where_values;
void clear() {
columns.clear();
count_columns.clear();
limit.reset();
order_by.reset();
where.reset();
where_values.clear();
}
void clear();
};
using row = db_row<context>;
@ -74,6 +84,8 @@ public:
[[nodiscard]] auto go() const -> db_result<context>;
[[nodiscard]] auto group_by(std::string column_name) -> db_select &;
[[nodiscard]] auto
group(context::w_t::group_func_t func) -> context::w_t::wn_t;

View File

@ -34,7 +34,20 @@ public:
context(sqlite3 &db3_, std::string table_name_)
: db_context_t(db3_, table_name_) {}
using w_t = db_where_t<context, db_update>;
struct db_update_op_t final {
std::shared_ptr<context> ctx;
[[nodiscard]] auto dump() const -> std::string;
[[nodiscard]] auto go() const -> db_result<context>;
[[nodiscard]] auto limit(std::int32_t value) -> db_update_op_t;
[[nodiscard]] auto order_by(std::string column_name,
bool ascending) -> db_update_op_t;
};
using w_t = db_where_t<context, db_update_op_t>;
std::map<std::string, db_types_t> column_values;
std::optional<std::int32_t> limit;
@ -42,13 +55,7 @@ public:
std::optional<w_t> where;
std::vector<db_types_t> where_values;
void clear() {
column_values.clear();
limit.reset();
order_by.reset();
where.reset();
where_values.clear();
}
void clear();
};
using row = db_row<context>;