dlang-community / d2sqlite3

A small wrapper around SQLite for the D programming language
Boost Software License 1.0
75 stars 26 forks source link

Expose CachedRow #55

Closed wilsonjord closed 5 years ago

wilsonjord commented 5 years ago

Currently, CachedResults is how to persist all the rows of a query in memory.

I'd like to use CachedRow in a different data structure, but it's currently defined as a nested struct within CachedResults.

Is there a way to move CachedRow outside of CachedResults, so it can be imported?

Note: CachedRow doesn't appear to use anything in it's outter (CachedResults) scope.

My current workout is have a direct copy/paste of the CachedRow struct into my own module, and then casting the result.

Thanks,

Jordan

biozic commented 5 years ago

I could extract CacheRow and put it at module scope, but you could also just do:

import d2sqlite3.results : CachedResults;
alias CachedRow = CachedResults.CachedRow;

struct Foo {
    CachedRow row;
}

or am I missing the point?

wilsonjord commented 5 years ago

No, it is me that is missing the point. I never would have thought of something like that, I should have gone to the forums first. Thanks for your help.

biozic commented 5 years ago

No worries.