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
snsei has joined #amber
snsei has quit [Remote host closed the connection]
<robacarp> I sure wish they would
<FromGitter> <Blacksmoke16> it was brought up before https://github.com/crystal-lang/crystal/issues/7000
<FromGitter> <Blacksmoke16> will come down to having a better alternative and implementing it
<FromGitter> <Blacksmoke16> but im not sure what a better alternative would be without conflicting with something else
<robacarp> and that's why haskell has 29387498 operators
<FromGitter> <Blacksmoke16> ``` # <Granite::Column(primary: true)> ⏎ property value1 : Int32``` [https://gitter.im/amberframework/amber?at=5bff33187074b903686fac43]
<FromGitter> <Blacksmoke16> :shrug:
<FromGitter> <drujensen> I think I am still leaning toward @robacarp idea inside a `do end` block. For some reason the annotations just doesn’t read well. Ruby reads like a text book if its done right.
<robacarp> I worry that the annotations feature of crystal feels underdeveloped too, like mutable constants
<FromGitter> <drujensen> yeah, true
<FromGitter> <drujensen> bleeding edge stuff. but heck, I’ve rewritten granite 10 times by now. lol.
<FromGitter> <drujensen> ;-)
<FromGitter> <drujensen> feels like we are going full circle
<FromGitter> <Blacksmoke16> hehe
<FromGitter> <Blacksmoke16> long as each version is better than the last
<FromGitter> <drujensen> started out as an ORM for amethyst
<FromGitter> <drujensen> https://github.com/amberframework/granite/tree/b05934e3528ecf7cc3f5b86db658b4f7935ff86b#usageThen renamed to Kemalyst model when I started working on the framework.
<FromGitter> <drujensen> I kinda like the `sql_mapping`
<FromGitter> <Blacksmoke16> i could go for @robacarp 's example.
<FromGitter> <Blacksmoke16> however my gripe with the mapping style of things is it requires more inherit knowledge of the ORM to use. Versus `oh i just declare properties like i always do in my classes, inherit from Granite::Base, and add some annotations and im done`
<FromGitter> <drujensen> does it?
<FromGitter> <drujensen> seems like the annotations would require the same knowledge, no?
<FromGitter> <Blacksmoke16> not that we have any way of testing it atm, but what happens if you do a sql mapping and also provide properties? do the properties exist on the model but not in db?
<FromGitter> <drujensen> yeah, they will fail because the macro would try to create the same property
<FromGitter> <Blacksmoke16> er i mean like if they have separate names
<FromGitter> <drujensen> but it would be the same as now declaring the `property` and then `field`
<FromGitter> <drujensen> oh
<FromGitter> <Blacksmoke16> like virtual properties
<FromGitter> <drujensen> that should be fine
<FromGitter> <drujensen> the mapping would only persist the fields defined
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <drujensen> JSON would be interesting though
<FromGitter> <drujensen> back to annotations?
<FromGitter> <drujensen> for json?
<FromGitter> <Blacksmoke16> if the mapping creates properties under the hood it should just work
<FromGitter> <Blacksmoke16> i guess my way of thinking about this is like a model class should look very similar to a normal crystal class
<FromGitter> <drujensen> yeah, i agree. The `finished` macro made that possible.
<FromGitter> <drujensen> and mutable constants
<FromGitter> <Blacksmoke16> like json/yaml use annotations, my third part shard does, if things continue down this road having the properties themselves exposed makes supporting stuff like that much easier
<FromGitter> <drujensen> yeah, i agree
<FromGitter> <Blacksmoke16> with a lot less logic under the hood to manage all of that
<FromGitter> <drujensen> if this is the way crystal is going...
<FromGitter> <drujensen> but i will become less a fan of it…:-(
<FromGitter> <Blacksmoke16> :shrug: just have to see how it goes and go from there
<FromGitter> <drujensen> yeah, i think its great you are investigating this
<FromGitter> <drujensen> if crystal adopts it in the core, i think we should as well
<FromGitter> <drujensen> its still 10 times nicer than Go.
<FromGitter> <Blacksmoke16> coming from PHP land, we use Symfony at work
<FromGitter> <drujensen> or PHP
<FromGitter> <Blacksmoke16> we take good advantage of their annotations and it makes things super slick imo
<FromGitter> <Blacksmoke16> is what inspired :p https://github.com/Blacksmoke16/CrSerializer
<FromGitter> <Blacksmoke16> for sure
<FromGitter> <drujensen> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5bff3b1a7074b903686fdd30]
<FromGitter> <drujensen> its a comment
<FromGitter> <Blacksmoke16> mhm
<FromGitter> <drujensen> in PHP is annotations just comments?
<FromGitter> <Blacksmoke16> yea is just `@annotation`
<FromGitter> <Blacksmoke16> similar to java
<FromGitter> <Blacksmoke16> but inside comments
<FromGitter> <drujensen> ```# @Granite::Primary ⏎ field id : Int64``` [https://gitter.im/amberframework/amber?at=5bff3b9ced6bcf1ef877beeb]
<FromGitter> <drujensen> hmm, not too bad.
<FromGitter> <Blacksmoke16> indeed
<FromGitter> <Blacksmoke16> could work
<FromGitter> <Blacksmoke16> beyond me how to implement that so would have to get backing by rest of community
<FromGitter> <drujensen> lol, right
<FromGitter> <drujensen> anyway, going to play some games with my son. ttyl
<FromGitter> <drujensen> minecraft. lol
<FromGitter> <Blacksmoke16> get him factorio ;)
<FromGitter> <anamba> suggestion: https://keepachangelog.com/
<FromGitter> <anamba> ah, this has come up before. https://github.com/amberframework/amber/issues/835 so was the solution to put release notes on the github releases page?
<FromGitter> <anamba> btw, to add to the granite discussion, i have been working on an ORM for Neo4j: https://github.com/upspring/neo4j_model.cr i am still new to crystal, so keep that in mind (~5-6 weeks experience now), but i went with using regular Crystal properties. Planning to try out annotations for special cases, but right now I don't use them.
<FromGitter> <Blacksmoke16> its pretty much same implementation as you are doing now as far as i can tell, just using annotation to specify which properties should be persisted
<FromGitter> <Blacksmoke16> but could also work other way, persist all properties unless they are annotated with like `@[Granite::Virtual]`
<FromGitter> <Blacksmoke16> or something
<FromGitter> <robacarp> I agree that Granite should follow Crystal core direction... if they really embrace annotations, then it makes sense for Granite to follow suite. Admittedly I’m not as up on crystal style in the compiler as I used to be, but in 0.26 the only code in stdlib that used it was the json/yaml stuff. It makes me nervous that we would be swapping one deprecated paradigm (mutable constants) for another. ⏎ ⏎ Admittedly
<FromGitter> ... nerves aren’t facts, but any changes in this area of Granite are big, breaking, and highly visible... so I’d hope not to be making drastic changes tooo often.
<FromGitter> <Blacksmoke16> for sure, not planning on it getting merged anytime soon, more of just exploring possibilities/limitations atm
<FromGitter> <Blacksmoke16> at least then we'd be more prepared/informed to make a decision
<FromGitter> <robacarp> Absolutely! I’m a huge fan of exploratory coding
<FromGitter> <robacarp> One thing I *love* about annotations is how they stack vertically rather than just extend the line
<FromGitter> <Blacksmoke16> indeed
<FromGitter> <robacarp> Another is how widely extensible they are — third party libraries can be easily added which can read them when included into a model
<FromGitter> <Blacksmoke16> for sure, so could allow for granite extensions that can be installed separately for example
<FromGitter> <Blacksmoke16> was thinking of doing something like that for my validation shard, would be quite slick
<FromGitter> <Blacksmoke16> not sure on what or how tho, idea was granite could implement an abstract class that can be implemented by third part extensions
<FromGitter> <Blacksmoke16> oh btw, was working on the aggregate functions, how could i better integrate them with the query builder? as of now i dont think it works like `Model.where(:value, :gt, 100).min(:value, Int32)`
<FromGitter> <Blacksmoke16> like it would have to be able to edit the `select` portion of the query that gets executed on `select`
<FromGitter> <Blacksmoke16> vs just running its own query
<robacarp> hm, I'm not sure
<robacarp> well, actually
<robacarp> count and first both build their own query completely from scratch: https://github.com/amberframework/granite/blob/master/src/granite/query/assemblers/base.cr#L111-L134
<FromGitter> <Blacksmoke16> hmm ill have to test it again, thats how i set it up
<FromGitter> <Blacksmoke16> is the ultimate goal to move everything to that, including like all and find etc/
<FromGitter> <robacarp> #all will probably stay where it is, because it's so flexible and accessible
<FromGitter> <robacarp> \#find doesn't really need to be any sort of builder either, I don't think
<FromGitter> <Blacksmoke16> fair enough
<FromGitter> <robacarp> I think it would be really handy to have associations build out a chainable though
<FromGitter> <robacarp> User.friends.where(age: 34) or whatever
<FromGitter> <Blacksmoke16> oh yea that'd be nice
<FromGitter> <robacarp> It pretty close with the delayed fetch that is already in there
<FromGitter> <Blacksmoke16> that only on has many tho
<FromGitter> <Blacksmoke16> which is the only one that makes sense to have it on, nvm
_whitelogger has joined #amber
snsei has joined #amber
snsei has quit [Remote host closed the connection]
snsei has joined #amber
snsei has quit [Remote host closed the connection]
<FromGitter> <naiyt> Hi! Any ideas on what I'm doing wrong here? I've got the following route: ⏎ ⏎ ```║ get | Api::V1::EntryController | index | api_v1 | /api/v1 | /api/v1/entries ║``` [https://gitter.im/amberframework/amber?at=5c00593866213138943c0ca9]
<FromGitter> <naiyt> Well of course I figure it out as soon as I ask for help XD. Changing the resource to `resources "/entries", Api::V1::EntryController, only: [:index]` seems to fix it, guess you need that leading slash
<FromGitter> <drujensen> shouldn’t need it. looks like a bug to me
<FromGitter> <drujensen> glad you figured it out
<FromGitter> <naiyt> Yeah, might be a bug...doesn't seem to work without the leading slash, which is a bit odd because `amber routes` reports the route correctly. After double checking the docs I noticed there was a leading slash in the examples
<FromGitter> <elorest> No the leading `/slash` requirement is intentional. @drujensen. @naiyt glad you figured it out.
<FromGitter> <elorest> Maybe we could/should change it?
<FromGitter> <naiyt> Not sure if it matters, but there's not a requirement for a leading slash for a Rails resource, which I think is what confused me at first. If you wanted to keep it as a requirement maybe it would be good to have a runtime error when the routes are first evaluated, if you forgot it?
_whitelogger has joined #amber
<robacarp> a helpful is always a great addition