lpil / yesql

An Elixir library for using SQL.
Other
79 stars 7 forks source link

Support for multiple queries per file? #3

Open jsonmurphy opened 6 years ago

jsonmurphy commented 6 years ago

From the README and examples it seems (unlike clojure's yesql or even eql) only one query per file is supported. Was this a deliberate choice? or just not implemented as yet?

At the moment this is the only barrier for me to use this library exclusively as i foresee having to create many sql files for even a simple CRUD application with more than one db model/table.

lpil commented 6 years ago

Hiya. I didn't see any reason to support multiple queries per file, files are free and this allows a simpler parser and less syntax to learn.

I do plan to add support for a compile time string, which allows more flexibility

What's the advantage of a single file? :)

omh commented 5 years ago

Hi! Sorry to comment on an old issue. One benefit of a single file is not to having to add Yesql.defquery for each file. Sometimes you have several small but related queries which makes sense to group into one file. Also having tons of small files means having to jump back and forth between files a lot. Not a huge "problem" of course, but a nice to have for sure.

(Thanks for a great library!)

lpil commented 5 years ago

Hi Ole, thanks for the kind words.

If there was a defquery like function that took a compile time string would using this in a loop be a suitable solution? I'd rather keep the API as simple as possible and let users build abstractions on top if needed.

omh commented 5 years ago

I think that would help, yes, but then again, there's other libraries that support multiple files. If you want to keep it simple that is of course 100% 👍

chouzar commented 4 years ago

I just found about ayesql which is very similar to this library but offers more power on compos ability and multiple scripts.

@lpil would it be sensible to close this issue and add a reference to ayesql in the README.md?

lpil commented 4 years ago

Sounds good!