Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
func Auth() *gin.RouterGroup
func Pub ¶
func Pub() *gin.RouterGroup
func Register ¶
func Register[M types.Model, REQ types.Request, RSP types.Response](router gin.IRouter, rawPath string, cfg *types.ControllerConfig[M], verbs ...consts.HTTPVerb)
Register registers HTTP routes for a given model type with specified verbs using default controller configuration. It supports common CRUD operations along with import/export functionality.
Parameters:
- router: The Gin router instance to register routes on
- path: Base path for the resource (automatically handles '/api/' prefix)
- verbs: Optional list of HTTPVerb to register. If empty, defaults to Most (basic CRUD operations)
Route patterns registered:
- POST /{path} -> Create
- DELETE /{path} -> Delete
- DELETE /{path}/:id -> Delete
- PUT /{path} -> Update
- PUT /{path}/:id -> Update
- PATCH /{path} -> Patch
- PATCH /{path}/:id -> Patch
- GET /{path} -> List
- GET /{path}/:id -> Get
- POST /{path}/import -> Import
- GET /{path}/export -> Export
- POST /{path}/batch -> CreateMany
- DELETE /{path}/batch -> DeleteMany
- PUT /{path}/batch -> UpdateMany
- PATCH /{path}/batch -> PatchMany
For custom controller configuration, pass a ControllerConfig object.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.