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> <sam0x17> is there a canonical way in granite to do count / min / max / average / sum queries?
<FromGitter> <Blacksmoke16> count already exists iirc
<FromGitter> <sam0x17> yes seems that it is ty
<FromGitter> <sam0x17> I was trying it on .all which was wrong but it's actually on the model itself and on where chains I think
<FromGitter> <sam0x17> what to do about min/max/average/sum though?
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <sam0x17> I'm adding them -- might submit a pr
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <sam0x17> I got it working for Granite::Querying however a little lost on how to do it on the actual query builder
<FromGitter> <Blacksmoke16> be similar to `.count` no?
<FromGitter> <sam0x17> more annoying because they have to have arguments , and count just calls assembler.count I guess I'll delve into whatever that assembler obejct is
<FromGitter> <sam0x17> ok that gets me somewhere it's all in here https://github.com/amberframework/granite/blob/master/src/granite/query/assemblers/base.cr
<FromGitter> <Blacksmoke16> iirc i remember trying to get aggregate stuff like this
<FromGitter> <Blacksmoke16> see that
<FromGitter> <Blacksmoke16> feel free to base your stuff off that if you want
<FromGitter> <Blacksmoke16> iirc you run into type issues since each adapter returns diff types for each aggregate method
<FromGitter> <Blacksmoke16> would deff be cool if you didnt have to specify those
<FromGitter> <sam0x17> got it working this way: ⏎ ⏎ ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5e90c36f3a85536c431fe44b]
<FromGitter> <sam0x17> need this for a project like today but will see about a pull request later
<FromGitter> <Blacksmoke16> kinda unfortunate that would return a `Float64 | Int64` tho?
<FromGitter> <sam0x17> yeah, or I could do `sum` and `sum_f` or something
<FromGitter> <Blacksmoke16> hm
<FromGitter> <sam0x17> also not sure if `Symbol | String` is the idiomatic granite way of specifying a column name
<FromGitter> <Blacksmoke16> is how things are typed in other places iirc
<FromGitter> <sam0x17> cool
<FromGitter> <Blacksmoke16> id rather get rid of symbols and use only strings, but :shrug:
<FromGitter> <sam0x17> my argument is they are necessary unless there is some way of monkey patching additional values into an enum (which I don't think there is but maybe that does work haven't tried)
<FromGitter> <sam0x17> and that's not a thing because the side effects would be bad so
<FromGitter> <sam0x17> eh
<FromGitter> <sam0x17> side note oh lol min and max should also support `Time`