package
0.0.0-20241018081110-072913901059
Repository: https://github.com/oldmacloud/crud.git
Documentation: pkg.go.dev

# Functions

AllowAllCors allows all origins, methods and headers.
CreateNested add a POST route to the group for creating a nested model: POST /:parentIdParam/field.
Crud add a group of CRUD routes for model T to the base router on relativePath.
CrudNested = GetNested + CreateNested + DeleteNested.
DeleteNested add a DELETE route to the group for deleting a nested model: DELETE /:parentIdParam/field/:childIdParam.
GetNested add a GET route to the group for querying a nested model: GET /:parentIdParam/field.
NewRouter creates a new router (a gin.New() router) with gin.Recovery() middleware, the log.Logger4Gin middleware, the gin_request_id.RequestID() middleware, and addon middlewares indicated by the options parameters.
WithMiddleware adds custom middlewares to the router.
WithRequestID adds the gin_request_id.RequestID() middleware, which adds a request_id in the context for each request.

# Type aliases

CrudOption is options to construct the router group.
RouterOption is an option to construct the router.