xhttp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 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 IsLocalIp

func IsLocalIp(ip string) (bool, error)

* 判断是否本地Ip *

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 PostFile added in v0.0.9

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

* 上传文件 *

func QueryEncode

func QueryEncode(value string) string

* Query编码 *

func RespFAIL added in v0.0.9

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

失败

func RespSUCESS added in v0.0.9

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

成功

func Response

func Response(c *gin.Context, httpCode int, code int, 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 Gin added in v0.0.9

type Gin struct {
	C *gin.Context
}

func (*Gin) Response added in v0.0.9

func (g *Gin) Response(code int, msg string, data interface{})

Jump to

Keyboard shortcuts

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