This commit is contained in:
		@@ -30,13 +30,15 @@ namespace repertory::db {
 | 
				
			|||||||
class db_delete final {
 | 
					class db_delete final {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  struct context final {
 | 
					  struct context final {
 | 
				
			||||||
 | 
					    using w_t = db_where_t<context, db_delete>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context(sqlite3 &db3_, std::string table_name_)
 | 
					    context(sqlite3 &db3_, std::string table_name_)
 | 
				
			||||||
        : db3(db3_), table_name(std::move(table_name_)) {}
 | 
					        : db3(db3_), table_name(std::move(table_name_)) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sqlite3 &db3;
 | 
					    sqlite3 &db3;
 | 
				
			||||||
    std::string table_name;
 | 
					    std::string table_name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    std::optional<db_where_t<context, db_delete>> where;
 | 
					    std::optional<w_t> where;
 | 
				
			||||||
    std::vector<db_types_t *> where_values;
 | 
					    std::vector<db_types_t *> where_values;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    db3_stmt_t stmt{nullptr};
 | 
					    db3_stmt_t stmt{nullptr};
 | 
				
			||||||
@@ -58,11 +60,10 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto go() const -> db_result<context>;
 | 
					  [[nodiscard]] auto go() const -> db_result<context>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto group(db_where_t<context, db_delete>::group_func_t func)
 | 
					 | 
				
			||||||
      -> db_where_t<context, db_delete>::wn_t;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  [[nodiscard]] auto
 | 
					  [[nodiscard]] auto
 | 
				
			||||||
  where(std::string column_name) const -> db_where_t<context, db_delete>::cn_t;
 | 
					  group(context::w_t::group_func_t func) -> context::w_t::wn_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [[nodiscard]] auto where(std::string column_name) const -> context::w_t::cn_t;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
} // namespace repertory::db
 | 
					} // namespace repertory::db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,6 +33,8 @@ public:
 | 
				
			|||||||
    context(sqlite3 &db3_, std::string table_name_)
 | 
					    context(sqlite3 &db3_, std::string table_name_)
 | 
				
			||||||
        : db3(db3_), table_name(std::move(table_name_)) {}
 | 
					        : db3(db3_), table_name(std::move(table_name_)) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    using w_t = db_where_with_limit_t<context, db_select>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sqlite3 &db3;
 | 
					    sqlite3 &db3;
 | 
				
			||||||
    std::string table_name;
 | 
					    std::string table_name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -40,7 +42,7 @@ public:
 | 
				
			|||||||
    std::map<std::string, std::string> count_columns{};
 | 
					    std::map<std::string, std::string> count_columns{};
 | 
				
			||||||
    std::optional<std::int32_t> limit;
 | 
					    std::optional<std::int32_t> limit;
 | 
				
			||||||
    std::optional<std::pair<std::string, bool>> order_by;
 | 
					    std::optional<std::pair<std::string, bool>> order_by;
 | 
				
			||||||
    std::optional<db_where_with_limit_t<context, db_select>> where;
 | 
					    std::optional<w_t> where;
 | 
				
			||||||
    std::vector<db_types_t *> where_values;
 | 
					    std::vector<db_types_t *> where_values;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    db3_stmt_t stmt{nullptr};
 | 
					    db3_stmt_t stmt{nullptr};
 | 
				
			||||||
@@ -68,16 +70,14 @@ public:
 | 
				
			|||||||
  [[nodiscard]] auto go() const -> db_result<context>;
 | 
					  [[nodiscard]] auto go() const -> db_result<context>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto
 | 
					  [[nodiscard]] auto
 | 
				
			||||||
  group(db_where_with_limit_t<context, db_select>::group_func_t func)
 | 
					  group(context::w_t::group_func_t func) -> context::w_t::wn_t;
 | 
				
			||||||
      -> db_where_with_limit_t<context, db_select>::wn_t;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto limit(std::int32_t value) -> db_select &;
 | 
					  [[nodiscard]] auto limit(std::int32_t value) -> db_select &;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto order_by(std::string column_name,
 | 
					  [[nodiscard]] auto order_by(std::string column_name,
 | 
				
			||||||
                              bool ascending) -> db_select &;
 | 
					                              bool ascending) -> db_select &;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto where(std::string column_name) const
 | 
					  [[nodiscard]] auto where(std::string column_name) const -> context::w_t::cn_t;
 | 
				
			||||||
      -> db_where_with_limit_t<context, db_select>::cn_t;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
} // namespace repertory::db
 | 
					} // namespace repertory::db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,6 +32,7 @@ public:
 | 
				
			|||||||
  struct context final {
 | 
					  struct context final {
 | 
				
			||||||
    context(sqlite3 &db3_, std::string table_name_)
 | 
					    context(sqlite3 &db3_, std::string table_name_)
 | 
				
			||||||
        : db3(db3_), table_name(std::move(table_name_)) {}
 | 
					        : db3(db3_), table_name(std::move(table_name_)) {}
 | 
				
			||||||
 | 
					    using w_t = db_where_with_limit_t<context, db_update>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sqlite3 &db3;
 | 
					    sqlite3 &db3;
 | 
				
			||||||
    std::string table_name;
 | 
					    std::string table_name;
 | 
				
			||||||
@@ -39,7 +40,7 @@ public:
 | 
				
			|||||||
    std::map<std::string, db_types_t> column_values{};
 | 
					    std::map<std::string, db_types_t> column_values{};
 | 
				
			||||||
    std::optional<std::int32_t> limit;
 | 
					    std::optional<std::int32_t> limit;
 | 
				
			||||||
    std::optional<std::pair<std::string, bool>> order_by;
 | 
					    std::optional<std::pair<std::string, bool>> order_by;
 | 
				
			||||||
    std::optional<db_where_with_limit_t<context, db_update>> where;
 | 
					    std::optional<w_t> where;
 | 
				
			||||||
    std::vector<db_types_t *> where_values;
 | 
					    std::vector<db_types_t *> where_values;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    db3_stmt_t stmt{nullptr};
 | 
					    db3_stmt_t stmt{nullptr};
 | 
				
			||||||
@@ -65,16 +66,14 @@ public:
 | 
				
			|||||||
  [[nodiscard]] auto go() const -> db_result<context>;
 | 
					  [[nodiscard]] auto go() const -> db_result<context>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto
 | 
					  [[nodiscard]] auto
 | 
				
			||||||
  group(db_where_with_limit_t<context, db_update>::group_func_t func)
 | 
					  group(context::w_t::group_func_t func) -> context::w_t::wn_t;
 | 
				
			||||||
      -> db_where_with_limit_t<context, db_update>::wn_t;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto limit(std::int32_t value) -> db_update &;
 | 
					  [[nodiscard]] auto limit(std::int32_t value) -> db_update &;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto order_by(std::string column_name,
 | 
					  [[nodiscard]] auto order_by(std::string column_name,
 | 
				
			||||||
                              bool ascending) -> db_update &;
 | 
					                              bool ascending) -> db_update &;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  [[nodiscard]] auto where(std::string column_name) const
 | 
					  [[nodiscard]] auto where(std::string column_name) const -> context::w_t::cn_t;
 | 
				
			||||||
      -> db_where_with_limit_t<context, db_update>::cn_t;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
} // namespace repertory::db
 | 
					} // namespace repertory::db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,19 +77,17 @@ auto db_delete::go() const -> db_result<context> {
 | 
				
			|||||||
  return {context_, res};
 | 
					  return {context_, res};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto db_delete::group(db_where_t<context, db_delete>::group_func_t func)
 | 
					auto db_delete::group(context::w_t::group_func_t func) -> context::w_t::wn_t {
 | 
				
			||||||
    -> db_where_t<context, db_delete>::wn_t {
 | 
					 | 
				
			||||||
  if (not context_->where.has_value()) {
 | 
					  if (not context_->where.has_value()) {
 | 
				
			||||||
    context_->where = db_where_t<context, db_delete>{context_};
 | 
					    context_->where = context::w_t{context_};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return context_->where->group(std::move(func));
 | 
					  return context_->where->group(std::move(func));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto db_delete::where(std::string column_name) const
 | 
					auto db_delete::where(std::string column_name) const -> context::w_t::cn_t {
 | 
				
			||||||
    -> db_where_t<context, db_delete>::cn_t {
 | 
					 | 
				
			||||||
  if (not context_->where.has_value()) {
 | 
					  if (not context_->where.has_value()) {
 | 
				
			||||||
    context_->where = db_where_t<context, db_delete>{context_};
 | 
					    context_->where = context::w_t{context_};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return context_->where->where(column_name);
 | 
					  return context_->where->where(column_name);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,11 +123,9 @@ auto db_select::go() const -> db_result<context> {
 | 
				
			|||||||
  return {context_, res};
 | 
					  return {context_, res};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto db_select::group(
 | 
					auto db_select::group(context::w_t::group_func_t func) -> context::w_t::wn_t {
 | 
				
			||||||
    db_where_with_limit_t<context, db_select>::group_func_t func)
 | 
					 | 
				
			||||||
    -> db_where_with_limit_t<context, db_select>::wn_t {
 | 
					 | 
				
			||||||
  if (not context_->where.has_value()) {
 | 
					  if (not context_->where.has_value()) {
 | 
				
			||||||
    context_->where = db_where_with_limit_t<context, db_select>{context_};
 | 
					    context_->where = context::w_t{context_};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return context_->where->group(std::move(func));
 | 
					  return context_->where->group(std::move(func));
 | 
				
			||||||
@@ -144,10 +142,9 @@ auto db_select::order_by(std::string column_name,
 | 
				
			|||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto db_select::where(std::string column_name) const
 | 
					auto db_select::where(std::string column_name) const -> context::w_t::cn_t {
 | 
				
			||||||
    -> db_where_with_limit_t<context, db_select>::cn_t {
 | 
					 | 
				
			||||||
  if (not context_->where.has_value()) {
 | 
					  if (not context_->where.has_value()) {
 | 
				
			||||||
    context_->where = db_where_with_limit_t<context, db_select>{context_};
 | 
					    context_->where = context::w_t{context_};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return context_->where->where(column_name);
 | 
					  return context_->where->where(column_name);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -133,11 +133,9 @@ auto db_update::go() const -> db_result<context> {
 | 
				
			|||||||
  return {context_, res};
 | 
					  return {context_, res};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto db_update::group(
 | 
					auto db_update::group(context::w_t::group_func_t func) -> context::w_t::wn_t {
 | 
				
			||||||
    db_where_with_limit_t<context, db_update>::group_func_t func)
 | 
					 | 
				
			||||||
    -> db_where_with_limit_t<context, db_update>::wn_t {
 | 
					 | 
				
			||||||
  if (not context_->where.has_value()) {
 | 
					  if (not context_->where.has_value()) {
 | 
				
			||||||
    context_->where = db_where_with_limit_t<context, db_update>{context_};
 | 
					    context_->where = context::w_t{context_};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return context_->where->group(std::move(func));
 | 
					  return context_->where->group(std::move(func));
 | 
				
			||||||
@@ -154,10 +152,9 @@ auto db_update::order_by(std::string column_name,
 | 
				
			|||||||
  return *this;
 | 
					  return *this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto db_update::where(std::string column_name) const
 | 
					auto db_update::where(std::string column_name) const -> context::w_t::cn_t {
 | 
				
			||||||
    -> db_where_with_limit_t<context, db_update>::cn_t {
 | 
					 | 
				
			||||||
  if (not context_->where.has_value()) {
 | 
					  if (not context_->where.has_value()) {
 | 
				
			||||||
    context_->where = db_where_with_limit_t<context, db_update>{context_};
 | 
					    context_->where = context::w_t{context_};
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return context_->where->where(column_name);
 | 
					  return context_->where->where(column_name);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user