app

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CulOffset

func CulOffset(page, pageSize int32) (offset int32)

CulOffset 计算偏移值

Types

type List

type List struct {
	List  interface{} `json:"list"`
	Total int64       `json:"total"`
}

type Page

type Page struct {
	DefaultPageSize int32
	MaxPageSize     int32
	PageKey         string // url中page关键字
	PageSizeKey     string // pagesize关键字
}

func InitPage

func InitPage(defaultPageSize, maxPageSize int32, pageKey, pageSizeKey string) *Page

InitPage 初始化默认页数大小和最大页数限制以及查询的关键字

func (*Page) GetPageSizeAndOffset

func (p *Page) GetPageSizeAndOffset(r *http.Request) (limit, offset int32)

GetPageSizeAndOffset 从请求中获取偏移值和页尺寸

type Response

type Response struct {
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func (*Response) Reply

func (r *Response) Reply(err errcode.Err, datas ...interface{})

Reply 响应单个数据

func (*Response) ReplyList

func (r *Response) ReplyList(err errcode.Err, total int64, data interface{})

ReplyList 响应列表数据

type State

type State struct {
	Code int         `json:"status_code"`    // 状态码,0-成功,其他值-失败
	Msg  string      `json:"status_msg"`     // 返回状态描述
	Data interface{} `json:"data,omitempty"` // 失败时返回空
}

State 状态码

type StrTo

type StrTo string

func (StrTo) Int

func (s StrTo) Int() (int, error)

func (StrTo) Int32

func (s StrTo) Int32() (int32, error)

func (StrTo) Int64

func (s StrTo) Int64() (int64, error)

func (StrTo) MustInt

func (s StrTo) MustInt() int

func (StrTo) MustInt32

func (s StrTo) MustInt32() int32

func (StrTo) MustInt64

func (s StrTo) MustInt64() int64

func (StrTo) MustUInt32

func (s StrTo) MustUInt32() uint32

func (StrTo) String

func (s StrTo) String() string

func (StrTo) UInt32

func (s StrTo) UInt32() (uint32, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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