client

package
v1.25.28-jh Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 18 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CONTENT_TYPE_FORM    = "x-form"
	CONTENT_TYPE_JSON    = "json"
	CONTENT_TYPE_RESTFUL = "restful"
	CONTENT_TYPE_FILE    = "file"
)

Variables

This section is empty.

Functions

func Call added in v1.19.0

func Call(service, uri string, op *Options) (result string, callErr error)

func CallPageT

func CallPageT[T any](service, uri string, op *Options) vo.ResponsePage[T]

CallPageT 调用微服务并解析 data.list/total/page/pageSize 分页响应。

func CallResultT

func CallResultT[T any](service, uri string, op *Options) models.Result[T]

CallResultT 调用使用 status/data/msg 协议的旧版微服务。

func CallT added in v1.19.0

func CallT[T any](service, uri string, op *Options) vo.Response[T]

CallT 调用微服务并解析 code/data/msg/srvTime 响应。

Types

type Options added in v1.19.0

type Options struct {
	Method   string                 `json:"method"`   //接口方法 GET|POST|PUT|DELETE
	Protocol string                 `json:"protocol"` //协议 x-form|json|restful
	Group    string                 `json:"group"`    //应用分组,用于nacos中分组,不传为当前nacos分组及默认分组
	Header   any                    `json:"header"`   //额外的头部参数
	Query    any                    `json:"query"`    //URL Query参数
	Data     any                    `json:"data"`     //x-form Postform参数
	Json     any                    `json:"json"`     //json或restful模式的body参数
	Path     map[string]string      `json:"path"`     //restful模式的路径参数
	Files    []grequests.FileUpload //文件上传数据
	Retry    bool                   `json:"retry"` //是否重试
}

Jump to

Keyboard shortcuts

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