ginlion

package
v0.0.0-...-304b2f4 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ginlion defines functionality to integrate lion with gin.

https://github.com/gin-gonic/gin

Full typical use:

import (
	"go.pedge.io/lion/env"
	"go.pedge.io/lion/gin"
)

func setupGin() error {
	if err := envlion.Setup(); err != nil {
		return err
	}
	engine := ginlion.Default()
	...
}

Some of the code here is copied from the gin repository. This code is under the MIT License that can be found at https://github.com/gin-gonic/gin/blob/master/LICENSE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() *gin.Engine

Default is the equivalent of gin's Default function.

func GlobalLoggerAndRecovery

func GlobalLoggerAndRecovery() gin.HandlerFunc

GlobalLoggerAndRecovery returns LoggerAndRecovery on the global proto Logger.

func LoggerAndRecovery

func LoggerAndRecovery(protoLoggerProvider func() protolion.Logger) gin.HandlerFunc

LoggerAndRecovery is the equivalent of both gin's Logger and Recovery middlewares.

Types

type Call

type Call struct {
	Method      string            `protobuf:"bytes,1,opt,name=method" json:"method,omitempty"`
	Path        string            `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"`
	Query       map[string]string `` /* 130-byte string literal not displayed */
	UserAgent   string            `protobuf:"bytes,4,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"`
	RequestForm map[string]string `` /* 161-byte string literal not displayed */
	ClientIp    string            `protobuf:"bytes,6,opt,name=client_ip,json=clientIp" json:"client_ip,omitempty"`
	StatusCode  uint32            `protobuf:"varint,7,opt,name=status_code,json=statusCode" json:"status_code,omitempty"`
	Duration    string            `protobuf:"bytes,8,opt,name=duration" json:"duration,omitempty"`
	Error       []string          `protobuf:"bytes,9,rep,name=error" json:"error,omitempty"`
}

func (*Call) Descriptor

func (*Call) Descriptor() ([]byte, []int)

func (*Call) GetClientIp

func (m *Call) GetClientIp() string

func (*Call) GetDuration

func (m *Call) GetDuration() string

func (*Call) GetError

func (m *Call) GetError() []string

func (*Call) GetMethod

func (m *Call) GetMethod() string

func (*Call) GetPath

func (m *Call) GetPath() string

func (*Call) GetQuery

func (m *Call) GetQuery() map[string]string

func (*Call) GetRequestForm

func (m *Call) GetRequestForm() map[string]string

func (*Call) GetStatusCode

func (m *Call) GetStatusCode() uint32

func (*Call) GetUserAgent

func (m *Call) GetUserAgent() string

func (*Call) ProtoMessage

func (*Call) ProtoMessage()

func (*Call) Reset

func (m *Call) Reset()

func (*Call) String

func (m *Call) String() string

Jump to

Keyboard shortcuts

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