middleware

package
v0.0.0-...-3d0adf2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : log.go # Created : 2019/1/8 16:46 # Last Modified : 2019/1/8 16:46 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : metrics.go # Created : 2019/1/8 17:47 # Last Modified : 2019/1/8 17:47 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : opentracing.go # Created : 2019/1/8 16:54 # Last Modified : 2019/1/8 16:54 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : recovery.go # Created : 2019/1/8 16:48 # Last Modified : 2019/1/8 16:48 # Describe : # # ====================================================

====================================================

# Copyright (C)2019 All rights reserved. # # Author : domchan # Email : 814172254@qq.com # File Name : request_id.go # Created : 2019/1/8 16:49 # Last Modified : 2019/1/8 16:49 # Describe : # # ====================================================

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggingMiddleware

func LoggingMiddleware(next http.Handler) http.Handler

LoggingMiddleware 返回日志middleware

func RecoveryMiddleware

func RecoveryMiddleware(returnFunc func(w http.ResponseWriter, r *http.Request, err interface{})) func(http.Handler) http.Handler

RecoveryMiddleware 防止程序因为不可预测的原因退出

func RequestID

func RequestID(ctx context.Context) string

RequestID 从context中获取request-id

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.Handler

RequestIDMiddleware 从req中获取request-id , 如果request不存在就生成一个,并将request写入ResponseWriter

Types

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

func NewMetrics

func NewMetrics(name string) *Metrics

func (*Metrics) Handler

func (m *Metrics) Handler(next http.Handler) http.Handler

type OpenTracing

type OpenTracing struct {
	// contains filtered or unexported fields
}

OpenTracing 用于跟踪请求的中间件

func NewOpenTracing

func NewOpenTracing(https bool) *OpenTracing

func (*OpenTracing) Handler

func (h *OpenTracing) Handler(next http.Handler) http.Handler

Handler middleware接口

Jump to

Keyboard shortcuts

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