Chapters
00:00 - Setting the Baseline
01:01 - Where Do We Define our Macros?
01:47 - Defining A GetCount Model Query Builder Macro
03:15 - Defining our Macro Types on the Model Query Builder
05:54 - Passing Arguments into Macros
What is a Model Query Builder Macro?
In AdonisJS, macros provide us a way to easily extend internal AdonisJS classes with our own methods. A lot in AdonisJS is macroable, including the request, response, and query builder.
When we add a macro, that function will then be readily available to use with instances of whatever class it is we've defined that macro. In the case of the Model Query Builder, adding a macro will make that function available within all model's query builders.
Join The Discussion! (0 Comments)
Please sign in or sign up for free to join in on the dicussion.
Be the first to Comment!