querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

Any plans to introduce compiler for in-memory data?

Open nikhilsarvaiye opened this issue 3 years ago • 5 comments

Any plans to introduce compiler for in-memory data in lists, collections? which can be useful in case of caching like Redis, or for general code performance.

I would love to know your thoughts, if would like I can contribute, thoughts?

nikhilsarvaiye avatar Dec 16 '22 09:12 nikhilsarvaiye

Nice idea!, but I don't think it's a matter of the compiler only. The job of a compiler is to convert C# statements to SQL string statements, so maybe a package with a broader scope would be needed in this case.

ahmad-moussawi avatar Dec 16 '22 09:12 ahmad-moussawi

Right, I would say we build Query and then Query to filter in-memory dictionaries. This way we can reuse the query object, I also have few ideas where and how joins can work in memory...

nikhilsarvaiye avatar Dec 16 '22 10:12 nikhilsarvaiye

I think DataTable.Select can use

Cricle avatar Jan 14 '23 06:01 Cricle

Has anyone tried SQLite in-memory feature? I've found this, but I haven't tried it yet. It sure seems as a viable solution for unit tests, where you would use it for in-memory mock DB.

michaelkruglos avatar Aug 02 '23 20:08 michaelkruglos

The unit tests already use this, I think you can follow the same approach

https://github.com/sqlkata/querybuilder/blob/master/QueryBuilder.Tests/SQLiteExecutionTest.cs#L263-L267

var cs = $"Data Source=file::memory:;Cache=Shared";
var connection = new SqliteConnection(cs);
var db = new QueryFactory(connection, new SqliteCompiler());       

ahmad-moussawi avatar Aug 03 '23 12:08 ahmad-moussawi