common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageUserCreated                  = "user successfully registered"
	MessageUserWithThisEmailExists      = "user with this email exists"
	MessageUserEmailOrPasswordIsInvalid = "email or password is invalid"
	MessageInternalServerError          = "there is a problem on our side"
	MessageSuccessfulLogin              = "welcome"
	MessageUnauthorized                 = "unauthorized"
	MessageNewPostCreated               = "new post created"
)

Variables

View Source
var Validate = validator.New()

Functions

func FormatResponse

func FormatResponse(resData ResponseData) finalResponse

func GetValidatorErrorMessage

func GetValidatorErrorMessage(tag string, field string, param string) string

Types

type ResponseData

type ResponseData struct {
	Data    map[string]interface{}
	Message string
	TrackId string
	IsError bool
}

type ValidationError

type ValidationError struct {
	FailedField string `json:"field"`
	Message     string `json:"message"`
}

func (*ValidationError) String

func (ve *ValidationError) String() string

Jump to

Keyboard shortcuts

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