fsprojects / Rezoom.SQL

Statically typechecks a common SQL dialect and translates it to various RDBMS backends
MIT License
670 stars 26 forks source link

Single row queries #13

Open rkosafo opened 7 years ago

rkosafo commented 7 years ago

Given the query

type UserCount = SQL<"Select count(*) as cnt from Users">

UserCount.Command has signature Command<IReadOnlyList<Row>>

Is there a way to write the query such that the output is Command<Row> so .Scalar() can be called on it instead of .Plan() or .ExactlyOne()?

Currently using .ExactlyOne() though.

rspeele commented 7 years ago

Right now, no way to do it. However it shouldn't be too hard to add this type of query (aggregates in the select clause, no group by, no limit) to the ones that get detected as single-row queries.