rest

package
v0.0.0-...-ffd5234 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAndValidate

func BindAndValidate(ctx *gin.Context, r interface{}) error

func PerformRequest

func PerformRequest(r http.Handler, method, path string, data io.Reader, token string) *httptest.ResponseRecorder

Method for tests

func ResponseError

func ResponseError(ctx *gin.Context, code int, err ErrorMessage)

func ResponseSuccess

func ResponseSuccess(ctx *gin.Context, code int, data interface{})

func ResponseValidationError

func ResponseValidationError(ctx *gin.Context, err validator.ValidationErrors)

Types

type ErrorMessage

type ErrorMessage struct {
	Message string                                 `json:"message"`
	Fields  validator.ValidationErrorsTranslations `json:"fields,omitempty"`
	Details string                                 `json:"details,omitempty"`
}

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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