8000 [FeatureRequest] Adding Hooks/Signals for post/pre insert/delete/update operations? · Issue #131 · moigagoo/norm · GitHub
[go: up one dir, main page]

Skip to content

[FeatureRequest] Adding Hooks/Signals for post/pre insert/delete/update operations? #131

@PhilippMDoerner

Description

@PhilippMDoerner

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 and updateEntry).

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0