Help us shape the future of Go! Take the 2026 Go Developer Survey

vo

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 3 Imported by: 0

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