common

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLogLevel = logrus.InfoLevel
View Source
const DefaultTimeFormat = "2006-01-02"

Variables

View Source
var Logger = logrus.New()
View Source
var (
	Validate *validator.Validate
)

Functions

func GetMongoURI

func GetMongoURI() string

GetMongoURI Resolves Mongo URI for the application database from environment variables.

func GetPort

func GetPort() string

GetPort Resolves port that application needs to be start from environment variables.

func NewApiError

func NewApiError(statusCode, code int, message string) error

NewApiError Returns a new API Error with custom statusCode, code and message

func NewBadRequestError

func NewBadRequestError() error

NewBadRequestError Returns a new API Error with Bad Request specified in it.

func NewBadRequestErrorWithMessage

func NewBadRequestErrorWithMessage(message string) error

NewBadRequestErrorWithMessage Returns a new API Error with Bad Request specified in it with custom message.

func TranslateValidationErrors

func TranslateValidationErrors(err error) (errorMessages string)

Types

type ApiError

type ApiError struct {
	StatusCode int
	Code       int
	Message    string
}

func (*ApiError) Error

func (e *ApiError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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