RepoDB icon indicating copy to clipboard operation
RepoDB copied to clipboard

Enhancement: Introduce the LiteralQueryField

Open mikependon opened this issue 3 years ago • 4 comments

Describe the enhancement

As some users are eager to maximize the underlying data store internal functions, the only way to do this is to introduce a possibilty for the user to write their own literal query expression on top of the object/fluent-based implementations.

var where = new LiteralQueryField("[Id] BETWEEN 10 AND 100");
var people = connection.Query<Person>(where);

In which the above query would return all the people from the Person table where the ID is 10 to 100.

mikependon avatar Sep 27 '22 19:09 mikependon

👏 Yes this is a much needed enhancement as it opens the possibility to use features currently not supported that would require fully managing the SQL command and inability to utilize RepoDBs other helpful features.

A great use case I encountered was trying to use SQL Server full text index features such as:

CONTAINS(product_description, "Snap Happy 100EZ" OR FORMSOF(THESAURUS,'Snap Happy') OR '100EZ')

cajuncoding avatar Sep 27 '22 23:09 cajuncoding

@cajuncoding - a bit hacky, but it could be a big help to most to access the DB's power. AFAIK, this works like NPoco.

mikependon avatar Sep 28 '22 05:09 mikependon

Very hacky suggestion done in #1125

ngardon avatar Dec 26 '22 11:12 ngardon

I was stalemate on this, TBH. Never I had explored your fixes to this one yet, but it sounds interesting how did you solved it without affecting the existing functionality of QueryField. Thanks for this PR.

mikependon avatar Dec 26 '22 12:12 mikependon