Red ORM for the Raku language - #red logs are going to be saved on logs.liz.nl, and later logs.raku.org
Set by SmokeMachine on 1 June 2021.
leont Question about the example in the README: in the .active-posts.grep example does that filtering client side or on the server? 01:47
I assume the former, but if it's the latter I'm really curious how you did that
japhb leont: One of the Red pieces of magic is that it essentially builds ASTs from simple greps and turns them into where clauses. Remember that .grep doesn't have to be the one provided by Raku. ;-) 02:50
SmokeMachine Not only for grep, but also map, first and etc… 03:21
leont: that’s DB side. You can see the generated SQL just below that on README. 03:23
leont: this is what’s used to do that: github.com/FCO/Red/blob/master/lib...de.pm6#L56 03:25
I plan to make it even more powerful with RakuAST once it’s done… 03:26
And here is the grep it uses: github.com/FCO/Red/blob/master/lib...q.pm6#L131 03:27
leont That sounds cool, but I'm not understanding it quite yet 11:30
PrepareCode.pm6#L62 looks like where the magic happens, but just calling func with a type object shouldn't do much, right? 11:31
And $try-again should be False at that point, so the next line should always return?? 11:50
lizmat pretty much looks like that, yes :-) 12:08
SmokeMachine Red::AST have a special Bool method… github.com/FCO/Red/blob/master/lib...ST.pm6#L28 13:24
leont: 👆 13:26
leont I didn't see that one coming 13:29
lizmat hmmm me neither 13:30
SmokeMachine (I hope that become much better with RakuAST) 13:32
leont Yeah, I don't think this can be done in a sane way without RakuAST. I'm surprised you got this far
SmokeMachine I hope it become as simple as a RakuAST —> Red::AST translator 13:35
lizmat: ant that’s why I wanted a easy way of getting the ast of a block… 👆 13:40
lizmat gotcha 13:41
SmokeMachine Would that make sense? 13:44
leont It makes sense on your side, but would it make sense to keep those ASTs around everywhere? 14:02
It's easy to imagine an «ast { ... }» block though 14:07
SmokeMachine I think that could be a way to do that optionally 14:57
leont Also, SQLite supports RETURNING nowadays (since 3.35), I think your docs would be a lot more readable if you used that 16:55
SmokeMachine leont: would mind to create an issue for that? 18:11
I'm preparing a presentation for The Raku Conference about Red and I'm wondering... to run an update for several rows, one could just run a map doing the changes on a ResultSeq and call .save on the returned ResultSeq, like this: `Post.^all.grep(not *.title.ends-with: "!!!").map({ .title ~= "!!!" }).save`... and now I'm wondering... should ResultSeq.sink call .save? 22:55
what do you all think? 22:56