app

package
v0.0.0-...-8960dd1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPage

func GetPage(c *gin.Context) int

func GetPageOffset

func GetPageOffset(page, pageSize int) int

func GetPageSize

func GetPageSize(c *gin.Context) int

Types

type Pager

type Pager struct {
	Items      any `json:"items"`
	Page       int `json:"page"`
	PageSize   int `json:"page_size"`
	TotalCount int `json:"total_count"`
	TotalPage  int `json:"total_page"`
}

type Response

type Response struct {
	Code    int      `json:"code"`
	Data    any      `json:"data,omitempty"`
	Msg     string   `json:"msg"`
	Details []string `json:"details,omitempty"`
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func (*Response) ToErrRespWithStatus

func (r *Response) ToErrRespWithStatus(err errcode.Error, status int)

func (*Response) ToErrorResponse

func (r *Response) ToErrorResponse(err errcode.Error)

func (*Response) ToResponse

func (r *Response) ToResponse(data any)

func (*Response) ToResponseList

func (r *Response) ToResponseList(list any, totalPage, totalCount int)

type ValidError

type ValidError struct {
	Key     string
	Message string
}

func (*ValidError) Error

func (v *ValidError) Error() string

type ValidErrorList

type ValidErrorList []*ValidError

func BindAndValid

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

func (ValidErrorList) Error

func (v ValidErrorList) Error() string

func (ValidErrorList) ToErrorList

func (v ValidErrorList) ToErrorList() []string

Jump to

Keyboard shortcuts

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