helper

package
v0.0.0-...-04e8982 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func TranslateErrorToStatusCode

func TranslateErrorToStatusCode(err error) int

Types

type BaseHttpResponse

type BaseHttpResponse struct {
	Result           any                           `json:"result"`
	Success          bool                          `json:"success"`
	ResultCode       ResultCode                    `json:"resultCode"`
	ValidationErrors *[]validation.ValidationError `json:"validationErrors"`
	Error            any                           `json:"error"`
}

func GenerateBaseResponse

func GenerateBaseResponse(result any, success bool, resultCode ResultCode) *BaseHttpResponse

func GenerateBaseResponseWithAnyError

func GenerateBaseResponseWithAnyError(result any, success bool, resultCode ResultCode, err any) *BaseHttpResponse

func GenerateBaseResponseWithError

func GenerateBaseResponseWithError(result any, success bool, resultCode ResultCode, err error) *BaseHttpResponse

func GenerateBaseResponseWithValidationError

func GenerateBaseResponseWithValidationError(result any, success bool, resultCode ResultCode, err error) *BaseHttpResponse

type ResultCode

type ResultCode int
const (
	Success ResultCode = 0

	ValidationError ResultCode = 40001

	AuthError ResultCode = 40101

	ForbiddenError ResultCode = 40301

	NotFoundError ResultCode = 40401

	LimiterError ResultCode = 42901

	OtpLimiterError ResultCode = 42902

	CustomRecovery ResultCode = 50001

	InternalError ResultCode = 50002
)

Jump to

Keyboard shortcuts

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