rsp

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailedOfStandard

func FailedOfStandard(ctx *gin.Context, code int, message string)

func FailedWithDataOfStandard

func FailedWithDataOfStandard(ctx *gin.Context, code string, message string, v any)

func ResponseHandler

func ResponseHandler() gin.HandlerFunc

func Success

func Success(ctx *gin.Context, object any)

func SuccessOfStandard

func SuccessOfStandard(ctx *gin.Context, v any)

Types

type DataArrayResponse

type DataArrayResponse[T any] struct {
	ResponseBase
	Data []T `json:"data"`
}

type DataResponse

type DataResponse[T any] struct {
	ResponseBase
	Data T `json:"data"`
}

type ErrorMessage

type ErrorMessage struct {
	Request    Request
	Response   DataResponse[any]
	Cost       string
	StatusCode int
}

type PagedData

type PagedData[T any] struct {
	Total         int64 `json:"total"`
	Size          int64 `json:"size"`
	Current       int64 `json:"current"`
	Pages         int64 `json:"pages"`
	IsSearchCount bool  `json:"isSearchCount"`
	Records       []T   `json:"records"`
}

type PagedResponse

type PagedResponse[T any] struct {
	ResponseBase
	Data PagedData[T] `json:"data"`
}

type Request

type Request struct {
	Method     string
	Uri        string
	Ip         string
	Headers    http.Header
	Parameters gin.Params
	Body       any
}

type Response added in v1.1.1

type Response struct {
	Request    Request
	Response   DataResponse[any]
	Cost       string
	StatusCode int
}

type ResponseBase

type ResponseBase struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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