middlewares

package
v0.0.0-...-a22ae41 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MsgInvalidJson     = "Invalid JSON format"
	MsgInvalidJsonType = func(e *json.UnmarshalTypeError) string {
		return "Expected " + e.Value + " but given type is " + e.Type.String() + " in JSON"
	}
	MsgValidationFailed      = "Invalid inputs"
	MsgValidationFieldFailed = func(e *validator.FieldError) string {

		switch e.Tag {
		case "required":
			return "Input required"
		}
		return "Invalid input format [" + e.Tag + "]"
	}
)

Functions

func ConnectDB

func ConnectDB(dbSession *mgo.Session) gin.HandlerFunc

func ErrorHandler

func ErrorHandler() gin.HandlerFunc

Types

type ClientError

type ClientError struct {
	Message string             `json:"message,omitempty"`
	Errors  []ClientFieldError `json:"errors,omitempty"`
}

type ClientFieldError

type ClientFieldError struct {
	Code    string `json:"code,omitempty"`
	Field   string `json:"field,omitempty"`
	Message string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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