File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,28 @@ class DROGON_EXPORT DbClient : public trantor::NonCopyable
214214 (binder << std::forward<Arguments>(args), 0 )...};
215215 return internal::SqlAwaiter (std::move (binder));
216216 }
217+
218+ /* *
219+ * @brief Execute a SQL query asynchronously using coroutine support.
220+ * This overload accepts a vector of arguments to bind to the query.
221+ * @tparam T The type of the elements in the vector.
222+ * @param sql The SQL query string to execute.
223+ * @param args A vector of arguments to bind to the query.
224+ * @return A SqlAwaiter object that can be co_awaited to retrieve the query
225+ * result.
226+ * @note This method is only available when coroutine support is enabled.
227+ */
228+ template <typename T>
229+ internal::SqlAwaiter execSqlCoro (const std::string &sql,
230+ const std::vector<T> &args) noexcept
231+ {
232+ auto binder = *this << sql;
233+ for (const auto &arg : args)
234+ {
235+ binder << arg;
236+ }
237+ return internal::SqlAwaiter (std::move (binder));
238+ }
217239#endif
218240
219241 // / Streaming-like method for sql execution. For more information, see the
You can’t perform that action at this time.
0 commit comments