common

package
v0.0.0-...-9f5e8be Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONError

func JSONError(ctx *fasthttp.RequestCtx, message string, statusCode int, err error)

JSONError creates a JSON-formatted error response and sends it to the client. It takes the fasthttp.RequestCtx, error message, and HTTP status code as parameters.

func JSONSuccess

func JSONSuccess(ctx *fasthttp.RequestCtx, data any, statusCode int)

JSONError creates a JSON-formatted error response and sends it to the client. It takes the fasthttp.RequestCtx, error message, and HTTP status code as parameters.

Types

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
	Status  int    `json:"status"`
	Error   error  `json:"error"`
}

ErrorResponse represents a JSON-formatted error response.

func (*ErrorResponse) MarshalJSON

func (j *ErrorResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*ErrorResponse) MarshalJSONBuf

func (j *ErrorResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*ErrorResponse) UnmarshalJSON

func (j *ErrorResponse) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*ErrorResponse) UnmarshalJSONFFLexer

func (j *ErrorResponse) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

Jump to

Keyboard shortcuts

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