> Sorry for late reply!
No worries! Heh, I figured you're probably super busy, right now.
> You may define your globals in lib/ of the app directory, as a
> standalone module. To my experience, put all your globals in a specific
> module is a common design pattern in Scheme. Usually, I name it env.scm, you may
> see a file in this name in almost all my serious projects.
Ahh; that makes sense. For a large project, that probably makes more sense, organizationally; it'd be much easier to segment things off.
> Yes, it's (run-when-sigint! proc), the proc is a thunk, say, it's
> a nullary function. You may put it to ENTRY.
Mmm; awesome. I figured there had to be something but could figure it out.
> These hooks are added since last release, so they'll appear in the doc
> in next release.
Ah, good to know. That's really great; I have no doubt that I'll make use of this, at some point…
Unrelated, I looking to delete some rows from a table with FPRM but (if I've read the source code correctly) it looks like such functionality doesn't currently exist. I was thinking to try putting together a pull-request to help but ran into a few inquiries.
It didn't seem to make sense to add the functionality to make-table-dropper since that function seems more about dropping or deleting tables, specifically (rather than rows); likewise for make-table-modifier, since it seemed more about modifying the structure of tables, rather than the data contained in tables. Not make-table-getter, for obvious reasons, and, while make-table-setter seemed the most similar, setting data isn't quite the same as deleting it.
So, I figured, just make a new function called make-table-deleter but it seemed like a lot of the inner functions – or, at least, the logic employed – for such a function would be similar to and have a lot of overlap with make-table-setter, creating some redundancy.
Heh, so I figured I'd inquire here; would it be helpful for me to try putting together a PR, any? Or were you holding off on implementing this functionality (in which case, not a good idea for a PR)? And, if otherwise, is there any preferred way or direction you'd want for the code of such a PR to be handled?
On Monday, October 12, 2020, 12:24:58 PM CDT, Nala Ginrut <firstname.lastname@example.org> wrote:
Sorry for late reply!
> Ah; that makes sense. I wasn't sure if Artanis offered a built-in mechanism, like Ruby on Rails; thanks for clarifying!
> One thing I had been wondering, previously, is if there's any way to
> store global variables that every file would have access to? I
> remember (way back, though) I tried defining variables in the ENTRY
> file but found that my controllers weren't able to recognize that such
> a variable had been defined.
You may define your globals in lib/ of the app directory, as a
standalone module. To my experience, put all your globals in a specific
module is a common design pattern in Scheme. Usually, I name it env.scm, you may
see a file in this name in almost all my serious projects.
> I'd figure that'd have use if, say, going the hash-table route and then being able to access that session data from any, say, controller.
> Is there, also, any way to have Artanis run commands on every quit? I was looking at Guile Redis and it dawned on me that quiting Artanis would quit without closing the Redis connection; but, if you could set commands to run on quit, you could just have Artanis close the connection on every quit that way.
Yes, it's (run-when-sigint! proc), the proc is a thunk, say, it's
a nullary function. You may put it to ENTRY.
These hooks are added since last release, so they'll appear in the doc
in next release.
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058