httpgin

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestContext

func RequestContext(c *gin.Context) context.Context

RequestContext returns the value associated with this context for key, or nil

func RequestId added in v1.4.15

func RequestId(ctx context.Context) string

RequestId returns the value associated with this context for key, or nil

func WithContext

func WithContext(c *gin.Context, ctx context.Context)

WithContext returns a copy of parent in which the value associated with key is val.

func WithRequestId added in v1.4.15

func WithRequestId(ctx context.Context, requestId string) context.Context

WithRequestId returns a copy of parent in which the value associated with key is val.

Types

type Config

type Config struct {
	EnableAccess    bool          `yaml:"enable_access" json:"enable_access" default:"true"`
	AccessLogbase   string        `yaml:"access_logbase" json:"access_logbase" default:"log"`
	EnablePprof     bool          `yaml:"enable_pprof" json:"enable_pprof" default:"true"`
	EnableMetrics   bool          `yaml:"enable_metrics" json:"enable_metrics" default:"true"`
	MetricsEndpoint string        `yaml:"metrics_endpoint" json:"metrics_endpoint" default:"/metrics"`
	EnableTraffic   bool          `yaml:"enable_traffic" json:"enable_traffic" default:"true"`
	EnableCheck     bool          `yaml:"enable_check" json:"enable_check" default:"true"`
	CheckEndpoint   string        `yaml:"check_endpoint" json:"check_endpoint" default:"/health"`
	Timeout         time.Duration `yaml:"timeout" json:"timeout" default:"60s"`
}

type Manager

type Manager interface {
	// GetEngine returns the gin.Engine.
	GetEngine() *gin.Engine
	// Use adds middleware to the chain which is run before router.
	Use(gin.HandlerFunc)
	// Run a http server.
	Run(addr ...string) error
}

func NewManager

func NewManager(cfg *Config) Manager

Jump to

Keyboard shortcuts

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