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
How can I add a custom chainable method to *gorm.DB: I want to add Paginate() method to the *gorm.DB instance and it shoulbe be chainable to other methods.
For example I want something like this:
db.Where("").Paginate(10) // where Paginate() is a custom method added to the db instance
Please I need this to avoid manually adding pagination logic to every part of the code where it is needed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How can I add a custom chainable method to *gorm.DB: I want to add Paginate() method to the *gorm.DB instance and it shoulbe be chainable to other methods.
For example I want something like this:
db.Where("").Paginate(10) // where Paginate() is a custom method added to the db instance
Please I need this to avoid manually adding pagination logic to every part of the code where it is needed.
Beta Was this translation helpful? Give feedback.
All reactions