qustavo / dotsql

A Golang library for using SQL.
GNU General Public License v2.0
741 stars 53 forks source link

Some questions #6

Closed stevencothren closed 9 years ago

stevencothren commented 10 years ago

Hi, I have just started looking at this project and I've had a couple of ideas. I wanted to see what your thoughts are and if the ideas are in line with where you are taking this project.

What do you think about exposing lookupQuery, so that callers can retrieve the SQL? What about exposing the ability to get all of the loaded query names?

How about adding a method to add queries after the initial file is loaded? Perhaps have the ability for dotsql to write out a valid config file that includes these newly added queries?

I guess I am seeing it as a potential query manager, but perhaps that should be a higher level application that just uses dotsql?

qustavo commented 10 years ago

Hi steven, thanks for your interest on the project.

Right now, lookupQuery is exposed through Raw func (d DotSql) Raw(name string) (string, error), I've added it so I can use dotsql with sql extensions like https://github.com/jmoiron/sqlx, and also compose more elaborated queries (like bulk INSERTs). About exposing all loaded query names, I don't see a benefit on that, I mean, you should know wich queries are inside your files, do you see any benefit?

Adding queries after initial file has been loaded sounds great, and I think it's related to #5, now, the purpose of dotsql is to avoid writing sql in your code, don't think that saving a file makes sense.