utils

package
v0.0.0-...-a474e13 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapHTTPMessage

func WrapHTTPMessage(context *gin.Context, code int, data interface{})

Types

type ErrorRespond

type ErrorRespond struct {
	Code   int    `json:"code"`
	Status string `json:"status"`
	Data   string `json:"data"`
}

type ServiceErrorData

type ServiceErrorData struct {
	Code    int
	Message any
}

func WrapDataRow

func WrapDataRow[T any](data *T, err error) (valueData *T, errData *ServiceErrorData)

func WrapDataRows

func WrapDataRows[T any](data []*T, err error) (valueData []*T, errData *ServiceErrorData)

func WrapPrimitiveValue

func WrapPrimitiveValue[T any](data T, err error) (valueData T, errData *ServiceErrorData)

type SuccessRespond

type SuccessRespond struct {
	Code   int    `json:"code"`
	Status string `json:"status"`
	Data   any    `json:"data"`
}

type ValidationError

type ValidationError struct {
	Code    int    `json:"code"`
	Status  string `json:"status"`
	Message any    `json:"message"`
}

Jump to

Keyboard shortcuts

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