bjornharrtell / PgKeyValueDB

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Support query by lambda in all Get methods #3

Open Revsgaard opened 4 months ago

Revsgaard commented 4 months ago

Support query by lambda with a Expression<Func<T, bool>> whereQuery = null parameter in all get mehods.

Revsgaard commented 4 months ago

@bjornharrtell lambda support would be a nice and performance optimization feature.

bjornharrtell commented 4 months ago

Agreed but it's likely non trivial. However existing implementation does exist in Npgsql EF Core support (https://www.npgsql.org/efcore/mapping/json.html#querying-json-columns-traditional-json-and-dom) but I'm not sure it can be used externally.

Revsgaard commented 4 months ago

No, Npgsql EF Core can probably not be used.

The solution is probably to generate the select string based on the Expression<Func<T, bool>> query in the CreateGetCommand method. https://stackoverflow.com/questions/2399009/how-does-c-sharp-lambda-work

bjornharrtell commented 4 months ago

Yes but I mean such logic already exists within the Npgsql EF Core logic, might extractable. And could even suggest to the Npgsql project it should be externalised in its own package.