sebastienros / yessql

A .NET document database working on any RDBMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve ISqlBuilder

MikeAlhayek opened this issue · comments

I am trying to use YesSql to create sql queries for reporting purposes. Build queries using ISqlBuilder isn't an easy thing. I have some suggestion to improve it.

  • Add Join(JoinType type, ....) method to allow for other join type like left or full join.

  • Why Is it required to call .Select() method even if AddSelector() is called? Maybe AddSelector() should call Select() or AddSelector() should only be available on a selectQueryBuilder object? Perhaps there is a reason for this.

  • Why do we need to explicitly add , to each selector or GroupBy? It should probably be much easier if that is done in the implementation. You should be able to easily join all the selector using , in ToSqlString()

  • Add AddSumSelector(...) this would allow us to create something like SUM(ColumnName)

  • Add AddCountSelector(...) this would allow us to create something like COUNT(ColumnName)

  • Add AddMinSelector(...) this would allow us to create something like MIN(ColumnName)

  • Add AddMaxSelector(...) this would allow us to create something like MAX(ColumnName)

  • Add AddAverageSelector(...) this would allow us to create something like AVG(ColumnName)

  • It would probably be amazing if we are able to create an instance of SqlBuilder from IQueryable<T> or something else that would translate IQueryable<T> to IQuery that YesSql would can execute.

I Like to add aggregation functions here

It would probably be amazing if we are able to create an instance of SqlBuilder from IQueryable or something else that would translate IQueryable to IQuery that YesSql would can execute.

Using IQueryable will require to create an expression trees, on other hand SqlBuilder will generate a raw SQL that can be executed directly

Yes. Having it part of the sqlQuilder ensures that the expression is translated properly to the server it's connected to (sql server, MySQL,.... syntax)