Skip to content

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

@crimson-gao

Description

@crimson-gao

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions