controllers

package
v0.0.0-...-d6be14c Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessMessage string = "success"
	SuccessCode    string = "success-200-s"
)
View Source
const (
	// 4XX
	ErrCodeRequestContentTypeNotJSONFormat string = "err-400-rctnjsonf"
	ErrMessageContentTypeNotJSONFromat     string = "Content-Type is not JSON format"

	ErrCodeRequestContentTypeNotFormDataFormat    string = "err-400-rctnfdf"
	ErrMessageRequestContentTypeNotFormDataFormat string = "Content-Type is not form-data format"

	ErrCodeRequestQueryParamsNotValid    string = "err-400-rqpnv"
	ErrMessageRequestQueryParamsNotValid string = "request query params is not valid"

	ErrCodeRequestPayloadCaptchaFieldNotValid    string = "err-400-rpcfnv"
	ErrMessageRequestPayloadCaptchaFieldNotValid string = "captcha not valid"

	ErrCodeRequestPayloadFieldNotValid    string = "err-400-rpfnv"
	ErrMessageRequestPayloadFieldNotValid string = "request payload some field is not valid"

	ErrCodeRequestPermissionUnauthorized    string = "err-401-rpu"
	ErrMessageRequestPermissionUnauthorized string = "unauthorized request"

	ErrCodeRequestPermissionForbidden    string = "err-403-rpf"
	ErrMessageRequestPermissionForbidden string = "no permission to access"

	// 5XX
	ErrCodeServerGeneralFunctionGotError  string = "err-500-sgfge"
	ErrCodeServerDatabaseCreateGotError   string = "err-500-sdbcge"
	ErrCodeServerDatabaseQueryGotError    string = "err-500-sdbqge"
	ErrCodeServerDatabaseUpdateGotError   string = "err-500-sdbuge"
	ErrCodeServerDatabaseDeleteGotError   string = "err-500-sdbdge"
	ErrCodeServerRedisSetNXKeyGotError    string = "err-500-srsnxkge"
	ErrCodeServerRedisSetKeyGotError      string = "err-500-srskge"
	ErrCodeServerRedisGetKeyGotError      string = "err-500-srgkge"
	ErrCodeServerRedisDeleteKeyGotError   string = "err-500-srdkge"
	ErrCodeServerSendEmailGotError        string = "err-500-ssege"
	ErrCodeServerGenerateJWTTokenGotError string = "err-500-sgjwttge"
)

All common error codes

Variables

This section is empty.

Functions

func GetFilteredNilRequestPayloadBsonM

func GetFilteredNilRequestPayloadBsonM(any interface{}) (bson.M, error)

func GetFilteredNilRequestPayloadMap

func GetFilteredNilRequestPayloadMap(any interface{}) map[string]interface{}

Types

type GormModelResponse

type GormModelResponse struct {
	ID        uint           `json:"id,omitempty"`
	CreatedAt time.Time      `json:"createdAt"`
	UpdatedAt time.Time      `json:"updatedAt"`
	DeletedAt gorm.DeletedAt `json:"deletedAt"`
}

type JSONResponse

type JSONResponse struct {
	Code    string      `json:"code"`
	Message interface{} `json:"message"`
	Data    interface{} `json:"data"`
}

func BindJSON

func BindJSON(c *gin.Context, r interface{}) (JSONResponse, error)

func InitAccountDataWhenSignUp

func InitAccountDataWhenSignUp(accountModel *models.Account) (errResponse JSONResponse, hasErr bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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