controllers

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseMessageOk = "ok!"
)

constants

Variables

This section is empty.

Functions

func GetAllUser

func GetAllUser(c echo.Context) error

GetAllUser - Return all users

func GetDurataionUsers

func GetDurataionUsers(c echo.Context) error

GetDurataionUsers - Return users retrived with pkg/model/duration_data

func Login

func Login(c echo.Context) error

Login - Define login controller

Types

type JwtCustomClaims

type JwtCustomClaims struct {
	Name string `json:"name"`
	jwt.StandardClaims
}

JwtCustomClaims - Define custom claims for token generation

type Response

type Response interface {
	GetCode() int
	GetSuccess() bool
	GetMessage() string
	GetContent() echo.Map
}

Response - Generalizes a resposne for web/api

func FailedResponse

func FailedResponse(c echo.Context, code int, message string, content echo.Map) Response

FailedResponse - Returns a failed Response

func NewResponse

func NewResponse(c echo.Context, success bool, code int, message string, content echo.Map) Response

NewResponse - Returns a new resposne based on the echo context

func SuccessResponse

func SuccessResponse(c echo.Context, content echo.Map) Response

SuccessResponse - Returns a success Response

type ResponseAPI

type ResponseAPI struct {
	Data    ResponseData `json:"data"`
	Content echo.Map     `json:"content,omitempty"`
}

ResponseAPI - Definea a standard struct response

func NewResponseAPI

func NewResponseAPI(success bool, code int, message string, content echo.Map) ResponseAPI

NewResponseAPI - Returns a new response api

func (ResponseAPI) GetCode

func (r ResponseAPI) GetCode() int

GetCode - Returns the api code response

func (ResponseAPI) GetContent

func (r ResponseAPI) GetContent() echo.Map

GetContent - Returns the content of the response

func (ResponseAPI) GetMessage

func (r ResponseAPI) GetMessage() string

GetMessage - Returns the response message

func (ResponseAPI) GetSuccess

func (r ResponseAPI) GetSuccess() bool

GetSuccess - Returns the outcome of the request

type ResponseData

type ResponseData struct {
	Code    int    `json:"code"`
	Success bool   `json:"success"`
	Message string `json:"message"`
}

ResponseData - Defines response data

Jump to

Keyboard shortcuts

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