faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
<FromGitter> <drujensen> @robacarp lots of stuff there. My take is that the DSL is just a representation of the SQL being created
<FromGitter> <drujensen> We have :nin and :nlike which are NOT IN and NOT LIKE operators
<FromGitter> <drujensen> I am tempted to make `.where` turn into `WHERE` instead of `AND`
<FromGitter> <drujensen> This will generate invalid syntax if you tried something like `Model.where(A).where(B)`
<FromGitter> <drujensen> But we have the case `.where(A, B)` which assumes `AND` as the join
<FromGitter> <drujensen> We can’t create `(` and `)` methods so we will need to find a DSL equivalent to generate a grouping.
<FromGitter> <drujensen> I think passing in a new querybuilder into another one is a good way to handle grouping
<FromGitter> <drujensen> for example `Model.where(Model.where(A).and(B)).or(C)`
<FromGitter> <Blacksmoke16> assuming that would be `WHERE (A AND B) OR C`?
<FromGitter> <drujensen> right
<FromGitter> <Blacksmoke16> i think that works well, the `()` of the outer `where` reflects the parens
<FromGitter> <drujensen> what do you think of this: `Model.where(:field, :in, Model.select(:id).where(field: value))`
<FromGitter> <Blacksmoke16> pretty readable imo
<FromGitter> <drujensen> passing a querybuilder as the value
<FromGitter> <drujensen> can we make these instance methods as well and get rid of the `Model`?
<FromGitter> <drujensen> `where(:field, :in, select(:id).where(field: value))`
<FromGitter> <drujensen> probably will conflict with existing methods though
<FromGitter> <drujensen> ```def where(**args) ⏎ self.where(args) ⏎ end``` [https://gitter.im/amberframework/amber?at=5bcfbbadab17df2631ddcd1d]
<FromGitter> <Blacksmoke16> hmm, the idea is good, implementation i'll leave to you :D
<FromGitter> <drujensen> haha
<FromGitter> <drujensen> I think I will leave it for a later enhancement
<FromGitter> <drujensen> something to consider
<FromGitter> <faustinoaq> Using Amber at classroom πŸ˜„ πŸŽ‰
<FromGitter> <Blacksmoke16> ayy nice one
<FromGitter> <bajro17> <3 So nice to see this
feepbot has quit [*.net *.split]
feepbot has joined #amber