ChanServ changed the topic of #crystal-lang to: The Crystal programming language | https://crystal-lang.org | Fund Crystal's development: https://crystal-lang.org/sponsors | GH: https://github.com/crystal-lang/crystal | Docs: https://crystal-lang.org/docs | Gitter: https://gitter.im/crystal-lang/crystal
_ht has joined #crystal-lang
Sankalp- has joined #crystal-lang
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp- is now known as Sankalp
<FromGitter> <moe:busyloop.net> yup i have used it for some smaller production things. it works ok but agree it has a bunch of rough corners. ⏎ ORMs are sadly hard and i think it's just one guy working on it. and not many alternatives on crystal, yet (there's also jennifer.cr but i've found that even rougher).
jmdaemon has quit [Ping timeout: 268 seconds]
<FromGitter> <moe:busyloop.net> hmm, i'm confused. https://archlinuxarm.org/packages/aarch64/crystal
<FromGitter> <moe:busyloop.net> i thought crystal doesn't do aarch64 on linux, yet? 🤔
<FromGitter> <moe:busyloop.net> otoh, there's also this: https://github.com/crystal-lang/crystal/blob/master/.github/workflows/aarch64.yml
* FromGitter * moe:busyloop.net scratches head
<FromGitter> <moe:busyloop.net> ohhh. 84codes has docker images for arm64, yay
Sankalp has quit [Ping timeout: 255 seconds]
Sankalp has joined #crystal-lang
<FromGitter> <borpzorp:midov.pl> terror of my girlcock_20221227085627.jpg (https://gitter.ems.host/_matrix/media/v1/download/midov.pl/oGGNDRhHkZmWFwDQSvPOBWoS)
<FromGitter> <Blacksmoke16> Packt is currently running a promotion from 13th December to 17th January where all eBooks are only $5 when purchased via Packt’s website. This would be a perfect time to pickup a copy of the "Crystal Programming" book if anyone hasn’t already done so! ⏎ ⏎ https://packt.link/VPmw7
<FromGitter> <moe:busyloop.net> @Blacksmoke16: what do i put in front of athena validator to validate strings? it seems to expect input values in the right type (e.g. GreaterThan won't work on a string).
<FromGitter> <Blacksmoke16> like the length of the string?
<FromGitter> <moe:busyloop.net> no, i have "3" and want to validate with GreaterThan
<FromGitter> <Blacksmoke16> `"3.".to_i`
<FromGitter> <moe:busyloop.net> yea can crystal do that for me or should i look elsewhere? :P
<FromGitter> <moe:busyloop.net> s/crystal/athena/
<FromGitter> <Blacksmoke16> where does the value come from?
<FromGitter> <moe:busyloop.net> ARGV
<FromGitter> <moe:busyloop.net> it's always a string, just looking for a cast & validate
<FromGitter> <moe:busyloop.net> or parse & validate rather
<FromGitter> <moe:busyloop.net> i assume athena does sth like that for request params, but dunno if it's pluggable for standalone use
<FromGitter> <Blacksmoke16> iirc its just like `Int64.new(value)` or whatever numeric type you want
<FromGitter> <Blacksmoke16> which calls the related `to_*` method on it
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/UInt64.html#new%28value%3AString%2Cbase%3AInt%3D10%2Cwhitespace%3ABool%3Dtrue%2Cunderscore%3ABool%3Dfalse%2Cprefix%3ABool%3Dfalse%2Cstrict%3ABool%3Dtrue%2Cleading_zero_is_octal%3ABool%3Dfalse%29%3Aself-class-method
<FromGitter> <Blacksmoke16> so depending on context could just always treat it as a float or Int64 then pass that thru
<FromGitter> <moe:busyloop.net> yea nah, i don't know what it is - that's what i want the validator to tell me, whether it's a valid int ;)
<FromGitter> <moe:busyloop.net> just still looking for excuses to use athena here - but every time i bump into something :(
<FromGitter> <Blacksmoke16> oh
<FromGitter> <Blacksmoke16> could just use https://athenaframework.org/Validator/Constraints/Regex/ with the regex from his lib :P
<FromGitter> <moe:busyloop.net> pfft :P
<FromGitter> <Blacksmoke16> prob be the easiest way `AVD::Constraints::Regex.new /^([-+]?[0-9]*\.?[0-9]*)$/` and tada
<FromGitter> <moe:busyloop.net> that's not the only validation i want, duh. if i'm gonna write all that stuff myself i don't need a shard
<FromGitter> <moe:busyloop.net> so i'll give some love to niche shards and use his - maybe next time athena, one day you'll be in my shard.yml :P
<FromGitter> <Blacksmoke16> yea but then you could easily pair it with like https://athenaframework.org/Validator/Constraints/Compound/ to get a single constraint to use for your needs. Also could leverage https://athenaframework.org/Validator/Constraints/Sequentially/ if so desired
<FromGitter> <moe:busyloop.net> yea athena has some cool stuff and looks clean and is well maintained, that's why i thought about it first
<FromGitter> <Blacksmoke16> ❤️
<FromGitter> <moe:busyloop.net> but for this case i don't need all that fancy stuff. i just need it to look at a string and tell me if it's value meets some constraint (and interpret it accordingly if it's a numeric constraint)
<FromGitter> <Blacksmoke16> if thats all you want to do prob dont even need a shard in that case
<FromGitter> <Blacksmoke16> `abort "Input must be an integer" unless ARGV[1].matches? /number_regex/`
<FromGitter> <moe:busyloop.net> the validations are user configurable. so some abstraction is needed. like... well, i have a shard now :)
<FromGitter> <Blacksmoke16> boo :p
<FromGitter> <moe:busyloop.net> i tried ¯\_(ツ)_/¯
_ht has quit [Remote host closed the connection]
hightower2 has quit [Ping timeout: 264 seconds]
jmdaemon has joined #crystal-lang