-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I would like to conditionally compose queries based on optional parameters passed to a function. A simple example would be:
auto do_query(const std::optional<Date>& date, const std::optional<User>& user, const std::optional<size_t> hash) {
auto query = EmptyCondition{};
if (date) {
query &= "date"_c == *date;
}
if (user) {
query &= "user"_c == *user;
}
if (hash) {
query &= "hash"_c == hash;
}
return session().and_then(
sqlgen::read<std::vector<DataType>> |
sqlgen::where(query).value();
}
Is something like this possible now? If not, is it possible to add?
Metadata
Metadata
Assignees
Labels
No labels