dohttp

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexHTML

func IndexHTML(basePath string) (string, error)

IndexHTML generates the main HTML page for the do library's web-based debugging interface. This function creates a welcome page that provides navigation to various debugging features and links to external resources like documentation and the GitHub repository.

Parameters:

  • basePath: The base URL path for the web interface (e.g., "/debug/di")

Returns the HTML content as a string and any error that occurred during generation.

The generated page includes:

  • Links to external resources (GitHub, documentation, etc.)
  • Navigation to scope and service inspection pages
  • Introduction to the debugging interface

Example:

html, err := http.IndexHTML("/debug/di")
if err != nil {
    log.Fatal(err)
}
fmt.Fprint(w, html)

func ScopeTreeHTML

func ScopeTreeHTML(basePath string, injector do.Injector, scopeID string) (string, error)

ScopeTreeHTML generates an HTML page that displays the scope tree structure of the DI container. This function creates a visual representation of the scope hierarchy, showing the relationships between scopes and the services they contain.

Parameters:

  • basePath: The base URL path for the web interface
  • injector: The injector instance to analyze
  • scopeID: The ID of the specific scope to highlight (optional)

Returns the HTML content as a string and any error that occurred during generation.

The generated page includes:

  • Visual representation of the scope hierarchy
  • Service icons indicating their type and capabilities
  • Navigation links between different views
  • Interactive scope inspection links

Example:

html, err := http.ScopeTreeHTML("/debug/di", injector, "")
if err != nil {
    log.Fatal(err)
}
fmt.Fprint(w, html)

func ServiceHTML

func ServiceHTML(basePath string, injector do.Injector, scopeID string, serviceName string) (string, error)

ServiceHTML generates an HTML page that displays detailed information about a specific service. This function creates a comprehensive service inspection page showing the service's scope, type, build time, invocation location, dependencies, and dependents.

Parameters:

  • basePath: The base URL path for the web interface
  • injector: The injector containing the service
  • scopeID: The ID of the scope containing the service
  • serviceName: The name of the service to inspect

Returns the HTML content as a string and any error that occurred during generation.

The generated page includes:

  • Service metadata (scope, type, build time, invocation location)
  • List of dependencies with clickable links
  • List of dependents with clickable links
  • Navigation to other views

If the scope or service is not found, it falls back to the service list page.

Example:

html, err := http.ServiceHTML("/debug/di", injector, "root", "database")
if err != nil {
    log.Fatal(err)
}
fmt.Fprint(w, html)

func ServiceListHTML

func ServiceListHTML(basePath string, injector do.Injector) (string, error)

ServiceListHTML generates an HTML page that displays a list of all services across all scopes. This function creates a comprehensive service listing page showing all services organized by their respective scopes.

Parameters:

  • basePath: The base URL path for the web interface
  • injector: The injector containing the services to list

Returns the HTML content as a string and any error that occurred during generation.

The generated page includes:

  • List of all scopes in the injector hierarchy
  • Services within each scope with clickable links
  • Navigation to other views
  • Service type indicators and capabilities

Example:

html, err := http.ServiceListHTML("/debug/di", injector)
if err != nil {
    log.Fatal(err)
}
fmt.Fprint(w, html)

Types

This section is empty.

Jump to

Keyboard shortcuts

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