Please make newQuery() the norm or add nq() alias for newQuery()
I seem to type .newQuery() for every query I write. It would be lovely if newQuery() was the norm, so one could skip that, and maybe add useExisting() for those rare instances when you don't want a new query. A switch in qb module settings that let one choose one mode over the other might make this feasible...
That being said, even though replace-in-files .newquery() with '', (possibly preceded by qb.from => qb.useExisting().from), wouldn't take long, it's quite a change. Maybe an alias would be helpful just to save keystrokes?
I appreciate your work as always!
Can you share an example where you are needing newQuery a lot? I tend to not need this in my own code, so I'd love to see your use case.
Sure - here are a couple of spots in the file I currently have open. https://www.screencast.com/t/LYlwr1JQ
On Thu, Jul 29, 2021 at 8:29 AM Eric Peterson @.***> wrote:
Can you share an example where you are needing newQuery a lot? I tend to not need this in my own code, so I'd love to see your use case.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/coldbox-modules/qb/issues/177#issuecomment-889243532, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7Y5YPJZFACBIT646HWQE3T2FXW3ANCNFSM5BGWV6XQ .
Do you use WireBox? These seem to be great places to use a provider.
Another option would be to use getInstance to get a new query builder
instance in each case. That’s basically what newQuery is doing under the
hood.
What it seems like you are asking for is a HyperBuilder as opposed to a
HyperRequest (to borrow an example from the hyper HTTP library). In qb
there is no HyperBuilder equivalent. We could investigate providing a
wrapper component kind of like QuickService in quick, but you can
accomplish the same thing with WireBox providers right now.
I don’t think the current QueryBuilder component will be changed in this
way, though. It would break many existing use cases as well as the mental
model of what a QueryBuilder is (a transient bag of configuration
options).
On Thu, Jul 29, 2021 at 9:58 AM Daemach @.***> wrote:
Sure - here are a couple of spots in the file I currently have open. https://www.screencast.com/t/LYlwr1JQ
On Thu, Jul 29, 2021 at 8:29 AM Eric Peterson @.***> wrote:
Can you share an example where you are needing newQuery a lot? I tend to not need this in my own code, so I'd love to see your use case.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <https://github.com/coldbox-modules/qb/issues/177#issuecomment-889243532 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AC7Y5YPJZFACBIT646HWQE3T2FXW3ANCNFSM5BGWV6XQ
.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/coldbox-modules/qb/issues/177#issuecomment-889267307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATWYXTAY76D4B6XH3F7HLTT2F3CHANCNFSM5BGWV6XQ .
-- Cheers, Eric
Yep, I'm using wirebox to inject querybuilder as qb. Using getinstance() would be even more verbose than newQuery(). I'm just trying to reduce typing :)
A nq() alias would work for me too. Maybe I don't understand clearly the difference between querybuilder and hyperbuilder - in both cases one is calling a set of functions to build an object then executing it with .get() or .send(). I do use wirebox to default a hyperbuilder instance with my api settings (some of which work and some don't...), but I wasn't thinking of that for qb. In my mind, qb is just building up a query for me. And in my case, every query is new, which makes newQuery() redundant.
On Thu, Jul 29, 2021 at 9:05 AM Eric Peterson @.***> wrote:
Do you use WireBox? These seem to be great places to use a provider. Another option would be to use
getInstanceto get a new query builder instance in each case. That’s basically whatnewQueryis doing under the hood.What it seems like you are asking for is a
HyperBuilderas opposed to aHyperRequest(to borrow an example from thehyperHTTP library). In qb there is noHyperBuilderequivalent. We could investigate providing a wrapper component kind of likeQuickServiceinquick, but you can accomplish the same thing with WireBox providers right now.I don’t think the current
QueryBuildercomponent will be changed in this way, though. It would break many existing use cases as well as the mental model of what aQueryBuilderis (a transient bag of configuration options).On Thu, Jul 29, 2021 at 9:58 AM Daemach @.***> wrote:
Sure - here are a couple of spots in the file I currently have open. https://www.screencast.com/t/LYlwr1JQ
On Thu, Jul 29, 2021 at 8:29 AM Eric Peterson @.***> wrote:
Can you share an example where you are needing newQuery a lot? I tend to not need this in my own code, so I'd love to see your use case.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/coldbox-modules/qb/issues/177#issuecomment-889243532 , or unsubscribe <
https://github.com/notifications/unsubscribe-auth/AC7Y5YPJZFACBIT646HWQE3T2FXW3ANCNFSM5BGWV6XQ
.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub <https://github.com/coldbox-modules/qb/issues/177#issuecomment-889267307 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AATWYXTAY76D4B6XH3F7HLTT2F3CHANCNFSM5BGWV6XQ
.
-- Cheers, Eric
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/coldbox-modules/qb/issues/177#issuecomment-889272810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC7Y5YJKH3QOB6GHIJT22WDT2F33FANCNFSM5BGWV6XQ .