controllers

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2020 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 - Interface per generalizzare una response api/web

func FailedResponse

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

FailedResponse - Restitusce una risposta failed

func NewResponse

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

NewResponse - Restituisce una nuova response generica in base al context passato

func SuccessResponse

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

SuccessResponse - Restituisce una risposta success

type ResponseAPI

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

ResponseAPI - Define a standard struct response

func NewResponseAPI

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

NewResponseAPI - Restituisce una response

func (ResponseAPI) GetCode

func (r ResponseAPI) GetCode() int

GetCode - Restituisce il codice della response api

func (ResponseAPI) GetContent

func (r ResponseAPI) GetContent() echo.Map

GetContent - Restituisce l'eventuale content della response api

func (ResponseAPI) GetMessage

func (r ResponseAPI) GetMessage() string

GetMessage - Restituisce il message della response api

func (ResponseAPI) GetSuccess

func (r ResponseAPI) GetSuccess() bool

GetSuccess - Restituisce l'esito della response api

type ResponseData

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

ResponseData - Definisce la struct della response.data

Jump to

Keyboard shortcuts

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