You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a BaseModel that has a GetDefaultFilters method. All my models implement BaseModel. GetDefaultFilters returns some default filters that must be injected in the where clause of every query on that model. How do I enforce this through hooks?
I used the before query hook, and it worked beautifully but that gets executed only for a few functions like Find, First etc. When I use Scan, it gets skipped.
If this is not possible, is there a way to only allow Find on these models?
The document you expected this should be explained
Your Question
I have a BaseModel that has a
GetDefaultFilters
method. All my models implement BaseModel. GetDefaultFilters returns some default filters that must be injected in the where clause of every query on that model. How do I enforce this through hooks?I used the before query hook, and it worked beautifully but that gets executed only for a few functions like Find, First etc. When I use Scan, it gets skipped.
If this is not possible, is there a way to only allow Find on these models?
The document you expected this should be explained
https://gorm.io/docs/hooks.html
Expected answer
The text was updated successfully, but these errors were encountered: