core

package
v0.0.0-...-8eb64e4 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: MIT Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Logger is the default application logger
	Logger = getLogger()
	// Config is the application configration
	Config *viper.Viper
	// Driver is applications http driver
	Driver *Engine
	// Errors contains applications errors
	Errors *Error
)

Functions

This section is empty.

Types

type Context

type Context = gin.Context

Context is a router context

type Engine

type Engine = gin.Engine

Engine is a http service drive

type Error

type Error struct {
	Message        string // error message
	Code           int    // app error code
	HttpStatusCode int    // http response code
	Err            error  // the original error
}

Error is a warpper over error to allow passing custom values to it.

func (*Error) Error

func (e *Error) Error() (result string)

func (*Error) Format

func (e *Error) Format(s fmt.State, verb rune)

func (*Error) JSON

func (e *Error) JSON(stack bool) interface{}

func (*Error) New

func (e *Error) New(err error) *Error

New creates an error with stack trace and http response code

func (*Error) NewError

func (e *Error) NewError(message string) *Error

NewError creates a new error from message

func (*Error) NewErrorf

func (e *Error) NewErrorf(format string, args ...interface{}) *Error

NewErrorf creates a new error from fromatted message

func (*Error) NewWithMessage

func (e *Error) NewWithMessage(err error, message string) *Error

NewWithMessage creates error with custom message for response

func (*Error) NewWithMessagef

func (e *Error) NewWithMessagef(err error, format string, args ...interface{}) *Error

NewWithMessagef creates error with formatted custom message for response

type Server

type Server interface {
	Init()
	Start()
	Exit(sig os.Signal)
}

Server provides methods for controlling application lifecycle

func NewServer

func NewServer(services ...Service) Server

NewServer initializes a new instance of server with all services

type Service

type Service interface {
	RegisterRoute(serviceDriver *Engine)
	Health() error
	Clean() error
}

Service provides methods for interacting with a microservice instance

Jump to

Keyboard shortcuts

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