common

package
v0.0.0-...-33f807e Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OkCode    = 0
	ErrorCode = 9999
)

Variables

View Source
var HttpClient *http.Client
View Source
var RedisClient *redis.Client
View Source
var SQLiteDb *gorm.DB

Functions

func Close

func Close()

Types

type PageRequest

type PageRequest struct {
	PageIndex int64 `form:"pageIndex"`
	PageSize  int64 `form:"pageSize"`
}

func GetPager

func GetPager(c *gin.Context) (PageRequest, error)

type RestResponse

type RestResponse struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

func GetErrorResponse

func GetErrorResponse(msg string) RestResponse

func GetOKResponse

func GetOKResponse(obj interface{}) RestResponse

func (*RestResponse) SetData

func (r *RestResponse) SetData(d interface{})

Jump to

Keyboard shortcuts

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