xhttp

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.1.0"

Functions

func GET

func GET(url string) (body string, err error)

func GetPage

func GetPage(c *gin.Context) (int, error)

func GetPageSize

func GetPageSize(c *gin.Context) (int, error)

func GetParamFromURI

func GetParamFromURI(c *gin.Context, key string) (int, error)

func GetQueryNumber

func GetQueryNumber(c *gin.Context, key string, defaultValue int) int

func GetUrlParam

func GetUrlParam(sourceUrl, paramName string) string

* 获取url里指定参数的值 *

func HttpPostFile

func HttpPostFile(url, filename, fileTag string, params map[string]string) (int, map[string][]string, string, error)

* 上传文件 *

func IsLocalIp

func IsLocalIp(ip string) (bool, error)

* 判断是否本地Ip *

func JSONErr

func JSONErr(c *gin.Context, code int, biz string, err error)

func JSONFail

func JSONFail(c *gin.Context, code int, msg string)

func JSONSucc

func JSONSucc(c *gin.Context, data interface{})

func JSONSuccess

func JSONSuccess(c *gin.Context, code int, msg string, data interface{})

公共结构体返回

func NewRequestForward

func NewRequestForward(c *gin.Context, url string) (*http.Response, error)

转发请求

func OpenUri

func OpenUri(uri string) error

Open calls the OS default program for uri

func POST

func POST(url string, data string) (body string, err error)

func QueryEncode

func QueryEncode(value string) string

* Query编码 *

func Response

func Response(c *gin.Context, httpCode int, code, msg string, data interface{})

func ScanRequestBody

func ScanRequestBody(c *gin.Context, params interface{}) error

func ToQueryString

func ToQueryString(values map[string]interface{}, args ...bool) string

* 字典转URL查询字符串 *

func UrlDecode

func UrlDecode(sourceUrl string) string

* Url解码 *

func UrlEncode

func UrlEncode(sourceUrl string) string

* Url编码 *

Types

type Resp

type Resp struct {
	Success bool        `json:"success"`
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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