-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FeatureRequest] Adding Hooks/Signals for post/pre insert/delete/update operations? #131
Comments
@moigagoo Is this feature something you would accept to be in norm? I'm pretty much using something like it already for exactly the usecase above. It consists of one The signalModule can be looked at here: https://github.com/PhilippMDoerner/NimStoryFont/blob/master/src/applications/core/signalSystem.nim Examples on how I use them:
For norm I'd write something up based on the signalSystem.nim module and add 2 Before I start adapting the above I'd want a statement as to whether that effort is even desired or not though. |
I would also like hooks for all operations, but for implementing telemetry. |
I have a webapplication with a Django backend that I am currently rewriting in nim using prologue and norm.
Django has a pretty neat signal system that allows you to run defined code before or after a data-manipulation-action such as insert, delete or update happens. In fact, I am implementing such a thing at the moment in my own side-project, because I made quite some use of it in my previous backend which was written in Django. In my case though, they are more "hooks" that you can use, rather than a proper signalling system.
The key idea of the implementation would be, to have pre-defined proc signatures that the user of norm can define and if they do define them, they are run. If they don't define them, that works just as well. For an example, I shall refer to my sideproject (that is my abstraction layer between my application and norm. See the procs
createEntry
,deleteEntry
andupdateEntry
).Since the code calling for such signal/hook procs is compiled away if they're not present, there would be no impact on performance by adding such a feature.
I can look into a norm-implementation of such a thing and submit a PR as I did for #127 , but I thought it might make sense to first even ask if such a feature is desired or if you see problems with it before I waste time on something unwanted.
The text was updated successfully, but these errors were encountered: