common

package
v0.0.0-...-3d95c69 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParsingFailed was occurred when request invalid syntax.
	ErrParsingFailed = errors.New("parsing is failed by invalid syntax")

	// ErrEntityNotFound was occurred when can't found entity.
	ErrEntityNotFound = errors.New("Entity was not found")

	// ErrAlreadyExistsEntity was occurred
	// when insert data that contain duplicated key.
	ErrAlreadyExistsEntity = errors.New("Already exists entity")

	// ErrInvalidUUID was occurred when uuid format was invalid.
	ErrInvalidUUID = errors.New("UUID was invalid")

	// ErrInvalidRequestPayload is occurred when payload is invalid.
	ErrInvalidRequestPayload = errors.New("Request payload is invalid")
)

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message string `json:"message"`
}

APIError is http error object.

type Controller

type Controller struct{}

Controller is common controller.

func NewController

func NewController() *Controller

NewController return new controller instance.

func (Controller) RegisterRoutes

func (c Controller) RegisterRoutes(router gin.IRouter)

RegisterRoutes is method that register api routes.

type ErrorResponse

type ErrorResponse struct {
	Errors []APIError `json:"errors"`
}

ErrorResponse is app response.

func NewErrResp

func NewErrResp(err error) ErrorResponse

NewErrResp is return new error response.

func (ErrorResponse) AddError

func (errResponse ErrorResponse) AddError(err error) ErrorResponse

AddError add new error at ErrorResponse.

Jump to

Keyboard shortcuts

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