gin

package module
v2.0.0-...-3e69e7e Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Use

func Use(router *gin.RouterGroup, injector do.Injector)

Use integrates the do library's web-based debugging interface with a Gin router. This function sets up HTTP routes for the debugging UI, allowing you to inspect your DI container through a web browser.

Parameters:

  • router: The Gin router group to add the debugging routes to
  • injector: The injector instance to debug

The function sets up the following routes:

  • GET /: The main debugging interface home page
  • GET /scope: Scope tree visualization with optional scope_id parameter
  • GET /service: Service inspection with optional scope_id and service_name parameters

Example:

router := gin.Default()
api := router.Group("/api")
debug := router.Group("/debug/di")

// Add the debugging interface
dogin.Use(debug, injector)

// Your application routes
api.GET("/users", userHandler)

The debugging interface will be available at /debug/di and provides:

  • Visual representation of scope hierarchy
  • Service dependency graphs
  • Service inspection and debugging tools
  • Navigation between different views

Security: Do not expose this group publicly in production. Protect it with authentication (e.g., Basic Auth) and/or network restrictions, since it can leak internals about your application's DI graph. Attach auth middleware to the router group before calling Use.

Types

This section is empty.

Jump to

Keyboard shortcuts

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