vo

package
v2.0.16 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ERROR   = 500
	SUCCESS = 1
	UnLogin = 999
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PageData

type PageData[T any] struct {
	List     []T   `json:"list"`
	Total    int64 `json:"total"`
	Page     int   `json:"page"`
	PageSize int   `json:"pageSize"`
}

type Response

type Response[T any] struct {
	Code    int       `json:"code"`
	Data    T         `json:"data"`
	Msg     string    `json:"msg"`
	SrvTime time.Time `json:"srvTime"`
}

func Error

func Error(status int, msg string) Response[any]

func ErrorT

func ErrorT[T any](status int, msg string) Response[T]

func ResponseToT

func ResponseToT[T any](result Response[any]) Response[T]

func Success

func Success(data any) Response[any]

func SuccessT

func SuccessT[T any](data T) Response[T]

func ToResponse

func ToResponse(r models.Result[any]) Response[any]

func (Response[T]) ToAny

func (r Response[T]) ToAny() Response[any]

type ResponsePage

type ResponsePage[T any] struct {
	Code    int          `json:"code"`
	Msg     string       `json:"msg"`
	SrvTime time.Time    `json:"srvTime"`
	Data    *PageData[T] `json:"data"`
}

func ErrorPage

func ErrorPage(status int, msg string) ResponsePage[any]

func ErrorPageT

func ErrorPageT[T any](status int, msg string) ResponsePage[T]

func ResponsePageToT

func ResponsePageToT[T any](result ResponsePage[any]) ResponsePage[T]

func SuccessPage

func SuccessPage(data any, page *models.ResultPage) ResponsePage[any]

func ToResponsePage

func ToResponsePage(r models.Result[any]) ResponsePage[any]

func (*ResponsePage[T]) ToAny

func (r *ResponsePage[T]) ToAny() ResponsePage[any]

Jump to

Keyboard shortcuts

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