responses

package
v0.0.0-...-db3ee06 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorResponse

func ErrorResponse(c echo.Context, statusCode int, message string) error

func MessageResponse

func MessageResponse(c echo.Context, statusCode int, message string) error

func NewPostResponse

func NewPostResponse(posts []models.Post) *[]PostResponse

func Response

func Response(c echo.Context, statusCode int, data interface{}) error

Types

type Data

type Data struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Error

type Error struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}

type LoginResponse

type LoginResponse struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
	Exp          int64  `json:"exp"`
}

func NewLoginResponse

func NewLoginResponse(token, refreshToken string, exp int64) *LoginResponse

type PostResponse

type PostResponse struct {
	Title    string `json:"title" example:"Echo"`
	Content  string `json:"content" example:"Echo is nice!"`
	Username string `json:"username" example:"John Doe"`
	ID       uint   `json:"id" example:"1"`
}

Jump to

Keyboard shortcuts

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