rom-rb / rom-sql

SQL support for rom-rb
https://rom-rb.org
MIT License
217 stars 93 forks source link

Feedback on ROM - Queries #364

Open janko opened 6 years ago

janko commented 6 years ago

First of all, the documentation for ROM is excellent! 👏 (both RDocs and guides)

The Projecting function results section inside the "SQL - Queries" guide shows adding function calls to the SQL query using this syntax:

int::count(...)
string::concat(...)

However, I couldn't find any clarification on this neither here nor in the rom-sql RDocs. I know that that this syntax is used for the SQL builder to know when you're adding a function call and when a column identifier (as both are method calls). But it would be great to have an explanation somewhere what are the typed int:: and string:: "namespaces" for, as I'm wondering why isn't there just a single function:: "namespace" 😃

solnic commented 6 years ago

Right, this should be documented. The reason why we require return type, is because we're inferring structs automatically, and we want to know both attribute names and their types.

solnic commented 6 years ago

One more thing, we have Any type, so it is possible to add a generic function builder that doesn't require return type, like the function:: syntax you proposed. WDYT @flash-gordon?

flash-gordon commented 6 years ago

@solnic sounds like a nice idea. I think we could have fun for brevity.

solnic commented 6 years ago

👉🏻 https://github.com/rom-rb/rom-sql/issues/270 👈🏻