Skip to content
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

Add a hook function after db operation inside http handlers #179

Open
crimson-gao opened this issue Apr 4, 2022 · 0 comments
Open

Add a hook function after db operation inside http handlers #179

crimson-gao opened this issue Apr 4, 2022 · 0 comments

Comments

@crimson-gao
Copy link

hey, there. I wonder if we counld add a post hook function inside http handlers.
We can modify fields here.
Here's an example.

func GetAllSystemRole_(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
        // ..... some  code

	result := &PagedResults{Page: page, PageSize: pagesize, Data: records, TotalRecords: totalRows}
        if err := systemrole_.AfterDBOperation(); err != nil {.  // add hook here
		returnError(ctx, w, r, dao.ErrServerInternal)
	}
	writeJSON(ctx, w, result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant