ginshared

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 20 Imported by: 4

Documentation

Index

Constants

View Source
const (
	KeyAddress = "address"
	KeyInitDB  = "database.initDB"
)
View Source
const (
	KeyTracingID = "tracingID"
)

Variables

View Source
var ControllerOptions = dig.Group("controllers")

Functions

func CloneRequestBody added in v0.1.14

func CloneRequestBody(c *gin.Context) []byte

func DropDuplicated added in v0.1.10

func DropDuplicated(raw []string) []string

func GetContainer

func GetContainer() *dig.Container

func MD5 added in v0.1.14

func MD5(raw []byte) string

func NewErrorReport added in v0.1.1

func NewErrorReport(replyCode int, logger *zap.Logger) gin.HandlerFunc

func Provide added in v0.2.0

func Provide(constructor interface{}, opts ...dig.ProvideOption) error

func ProvideController added in v0.2.0

func ProvideController(constructor interface{}) error

func ReportBadrequest added in v0.1.2

func ReportBadrequest(c *gin.Context, err error)

func Start

func Start() error

Types

type DiController

type DiController interface{}

type ErrorCode added in v0.1.1

type ErrorCode interface {
	ErrorCode() string
}

type GeneralResp added in v0.1.1

type GeneralResp struct {
	Succ         bool
	ErrorCode    string
	ErrorMessage string
}

type Params

type Params struct {
	dig.In
	Logger      *zap.Logger
	Router      *gin.Engine
	Bus         EventBus.Bus
	Controllers []DiController `group:"controllers"`
}

type ReportError added in v0.1.1

type ReportError struct {
	ReplyCode int
	// contains filtered or unexported fields
}

func (*ReportError) Middleware added in v0.1.1

func (handle *ReportError) Middleware(c *gin.Context)

func (*ReportError) RespErrorToClient added in v0.1.1

func (handle *ReportError) RespErrorToClient(c *gin.Context, err interface{})

type RespLogging added in v0.3.6

type RespLogging struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func (RespLogging) Write added in v0.3.6

func (w RespLogging) Write(b []byte) (int, error)

type TracingDetails added in v0.3.6

type TracingDetails struct {
	Origin   string
	Uri      string
	Method   string
	Body     string
	Durtion  time.Duration
	Status   int
	TargetID uint
	Resp     string
}

type TracingRequestService added in v0.3.6

type TracingRequestService struct {
	Bus     EventBus.Bus
	Log     *zap.Logger
	Enabled bool
	Request bool
	Resp    bool
}

func (*TracingRequestService) LogBody added in v0.3.6

func (tr *TracingRequestService) LogBody(req *TracingDetails)

func (*TracingRequestService) LogfullRequestDetails added in v0.3.6

func (tr *TracingRequestService) LogfullRequestDetails(c *gin.Context)

Jump to

Keyboard shortcuts

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