router

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth() *gin.RouterGroup

func Init

func Init() error

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.

func Run

func Run() error

func Stop

func Stop()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL