component

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleFileUpload

func HandleFileUpload(c *gin.Context, fieldName string) ([]byte, string, error)

HandleFileUpload 处理文件上传的通用逻辑

Types

type BetterRequest

type BetterRequest[T any] struct {
	Params T
	UserId uint64
	// contains filtered or unexported fields
}

func (*BetterRequest[T]) GetParams

func (r *BetterRequest[T]) GetParams() T

func (*BetterRequest[T]) GetUser

func (r *BetterRequest[T]) GetUser() (users.Entity, error)

type DataMap

type DataMap map[string]interface{}

type Null

type Null struct {
}

type NullRequest

type NullRequest BetterRequest[Null]

type Page

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

type Response

type Response struct {
	Code int
	Data ResultStruct
}

func BuildResponse

func BuildResponse(code int, data ResultStruct) Response

func FailResponse

func FailResponse(msg any) Response

func SuccessPage

func SuccessPage[T any](list []T, page, size int, total int64) Response

func SuccessResponse

func SuccessResponse(data any) Response

type ResultStruct

type ResultStruct struct {
	Msg    any    `json:"msg"`
	Result any    `json:"result"`
	Code   Status `json:"code"`
}

func FailData

func FailData(msg any) ResultStruct

func SuccessData

func SuccessData(data any) ResultStruct

type Status

type Status int
const (
	SUCCESS Status = iota // 成功
	FAIL                  // 失败
)

Jump to

Keyboard shortcuts

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