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
[Feature Request]: BeforeExecute, AfterExecute hook support #475
Comments
I'm going to add hooks to the library that will allow you to modify the generated SQL. I'm not sure that's what you are asking about however. This library does not execute SQL - we defer that to either MyBatis or Spring. So if you need execution hooks, you will need to do it in those libraries. In MyBatis that would probably mean writing a plugin or interceptor - you can read about MyBatis plugins on this page: https://mybatis.org/mybatis-3/configuration.html |
yeath, that what I wanted for BeforeHook. , back to AfterHook (my case) is to modify the result.(eg encrypt). in order to control the BeforeHook and AfterHook precisely, there should be a context I can pass a flag/variable in it. for example If set a variable/flag in context in BeforeHook for a sql, in the following AfterHook I can tell that's the very sql I am caring about by checking(and using) the flag/variable (eg, using it to encrypt the value) generally speaking: our use case can fall into two categories 1: simply using BeforeHook to modify the sql Thank you quick reply very much! |
Firstly thank you very much to build such useful framework. I am using it in my project. I have a use case for data privilege, for the same statement different user role would take different data privilege strategies. eg:
select a, b, c from ta
if current use a normal user then the return result of column c should be maksed as "xxxx", in our project (sass, multi-tenancy), there are many cases.
if the framework supports hooks, then we can handle the logic in one place. right now we mix such logic every where. it's not a good practice.
thank you!
The text was updated successfully, but these errors were encountered: