Skip to content

Conversation

trueqbit
Copy link
Collaborator

Type-erased iteration of result sets

Like originally asked in an inline question [answer] it can be desirable to pass a lazily generated query result across library boundaries. This library boundary should be independent of template arguments only used for traditional C++ views and iterators.

With C++23 we can make use of a coroutine-based generator for ranges.

Additionally to the iterate() method sqlite_orm's "storage" class now comes with a yield() method that returns a std::generator<result>.

I have chosen yield for the method name to create the range generator, as I didn't like generate, and yield says what it does.
Another good name for the new method could be query.

We have to agree on a name for the new "storage" method:
yield
query
generate
produce

@trueqbit trueqbit requested a review from fnc12 September 17, 2025 13:00
@fnc12
Copy link
Owner

fnc12 commented Sep 18, 2025

yield is a really good name @trueqbit . Thanks

@trueqbit trueqbit merged commit 1f82fe2 into dev Sep 18, 2025
4 checks passed
@trueqbit trueqbit deleted the std-generator branch September 18, 2025 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants