rpc

package
v0.0.0-...-9b3b26b Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet  = "GET"
	MethodPut  = "PUT"
	MethodPost = "POST"
)

Variables

This section is empty.

Functions

func ApiGetJson

func ApiGetJson(url string, reply interface{}) error

func ApiPostJson

func ApiPostJson(url string, args interface{}) error

func ApiPutJson

func ApiPutJson(url string, args, reply interface{}) error

func ApiResponseError

func ApiResponseError(err error) (int, string)

func ApiResponseJson

func ApiResponseJson(v interface{}) (int, string)

func EncodeURL

func EncodeURL(host string, format string, args ...interface{}) string

func NewToken

func NewToken(segs ...string) string

func NewXAuth

func NewXAuth(segs ...string) string

Types

type ApiRes

type ApiRes struct {
	Status int          `json:"status"`
	ErrMsg *RemoteError `json:"errmsg"`
	Data   interface{}  `json:"data"`
}

func NewApiResByData

func NewApiResByData(status int, data interface{}, errmsg *RemoteError) *ApiRes

type RemoteError

type RemoteError struct {
	Cause string      `json:"cause"`
	Stack trace.Stack `json:"stack"`
}

func NewRemoteError

func NewRemoteError(err error) *RemoteError

func (*RemoteError) Error

func (e *RemoteError) Error() string

func (*RemoteError) TracedError

func (e *RemoteError) TracedError() error

Jump to

Keyboard shortcuts

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