app

package
v0.0.0-...-6bf0a34 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccessHost

func GetAccessHost(c *gin.Context) string

func GetPage

func GetPage(c *gin.Context) int

func GetPageOffset

func GetPageOffset(page, pageSize int) int

func GetPageSize

func GetPageSize(c *gin.Context) int

func GetRequestIP

func GetRequestIP(c *gin.Context) string

GetRequestIP 获取ip

func RequestParamStrParse

func RequestParamStrParse(c *gin.Context, param any)

RequestParamStrParse 解析

Types

type Datetime

type Datetime time.Time

func (Datetime) MarshalJSON

func (t Datetime) MarshalJSON() ([]byte, error)

func (*Datetime) Scan

func (t *Datetime) Scan(v interface{}) error

func (*Datetime) String

func (t *Datetime) String() string

func (*Datetime) UnmarshalJSON

func (t *Datetime) UnmarshalJSON(data []byte) error

func (Datetime) Value

func (t Datetime) Value() (driver.Value, error)

type ErrResult

type ErrResult struct {
	// 业务状态码
	Code int `json:"code"`
	// 状态
	Status bool `json:"status"`
	// 失败&&成功消息
	Msg interface{} `json:"message"`
	// 错误格式数据
	Data interface{} `json:"data"`
	// 错误支付
	Details interface{} `json:"details"`
}

type ListRes

type ListRes struct {
	// 数据清单
	List interface{} `json:"list"`
	// 翻页信息
	Pager Pager `json:"pager"`
}

type Pager

type Pager struct {
	// 页码
	Page int `json:"page"`
	// 每页数量
	PageSize int `json:"pageSize"`
	// 总行数
	TotalRows int `json:"totalRows"`
}

type ResListResult

type ResListResult struct {
	// 业务状态码
	Code int `json:"code"`
	// 状态
	Status bool `json:"status"`
	// 失败&&成功消息
	Msg interface{} `json:"message"`
	// 数据集合
	Data ListRes `json:"data"`
}

type ResResult

type ResResult struct {
	// 业务状态码
	Code int `json:"code"`
	// 状态
	Status bool `json:"status"`
	// 失败&&成功消息
	Msg interface{} `json:"message"`
	// 数据集合
	Data interface{} `json:"data"`
}

type Response

type Response struct {
	Ctx *gin.Context
}

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func (*Response) SendResponse

func (r *Response) SendResponse(statusCode int, content interface{})

func (*Response) ToResponse

func (r *Response) ToResponse(code *code.Code)

ToResponse 输出到浏览器

func (*Response) ToResponseList

func (r *Response) ToResponseList(code *code.Code, list interface{}, totalRows int)

type ValidError

type ValidError struct {
	Key     string
	Message string
}

func (*ValidError) Error

func (v *ValidError) Error() string

type ValidErrors

type ValidErrors []*ValidError

func BindAndValid

func BindAndValid(c *gin.Context, v interface{}) (bool, ValidErrors)

func (ValidErrors) Error

func (v ValidErrors) Error() string

func (ValidErrors) Errors

func (v ValidErrors) Errors() []string

Jump to

Keyboard shortcuts

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