httpext

package
v0.0.0-...-2f8f7b3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartHttpGetAsync

func StartHttpGetAsync()

func StartHttpPostAsync

func StartHttpPostAsync()

Types

type AsyncHttpServer

type AsyncHttpServer struct {
	// contains filtered or unexported fields
}

func NewAsyncHttpServer

func NewAsyncHttpServer() *AsyncHttpServer

func (*AsyncHttpServer) RegisterRouter

func (h *AsyncHttpServer) RegisterRouter(router string, handler HttpAsyncHandler)

func (*AsyncHttpServer) StartServer

func (h *AsyncHttpServer) StartServer(uri string)

func (*AsyncHttpServer) StopServer

func (h *AsyncHttpServer) StopServer()

type HttpAsyncHandler

type HttpAsyncHandler func(form *HttpFormAsync) interface{}

type HttpForm

type HttpForm struct {
	Request  *http.Request
	Response http.ResponseWriter
	// contains filtered or unexported fields
}

======================================================================================

func (*HttpForm) GetArray

func (h *HttpForm) GetArray(key string) JsonArray

func (*HttpForm) GetBool

func (h *HttpForm) GetBool(key string) bool

func (*HttpForm) GetError

func (h *HttpForm) GetError() error

func (*HttpForm) GetInt

func (h *HttpForm) GetInt(key string) int

func (*HttpForm) GetInt64

func (h *HttpForm) GetInt64(key string) int64

func (*HttpForm) GetMap

func (h *HttpForm) GetMap(key string) JsonMap

func (*HttpForm) GetString

func (h *HttpForm) GetString(key string) string

func (*HttpForm) GetUint

func (h *HttpForm) GetUint(key string) uint

func (*HttpForm) GetUint64

func (h *HttpForm) GetUint64(key string) uint64

func (*HttpForm) HeaderValue

func (h *HttpForm) HeaderValue(key string) string

type HttpFormAsync

type HttpFormAsync struct {
	Resp chan interface{}
	HttpForm
	// contains filtered or unexported fields
}

type HttpRequest

type HttpRequest struct {
	// contains filtered or unexported fields
}
var HttpGet *HttpRequest
var HttpPost *HttpRequest

func NewHttpRequest

func NewHttpRequest(host string, reqType string) *HttpRequest

func (*HttpRequest) Request

func (r *HttpRequest) Request(router string, params interface{}) ([]byte, error)

func (*HttpRequest) RequestGet

func (c *HttpRequest) RequestGet(router string, header map[string]string) (*http.Response, error)

func (*HttpRequest) RequestJsonArray

func (r *HttpRequest) RequestJsonArray(router string, params interface{}) (JsonArray, error)

func (*HttpRequest) RequestJsonMap

func (r *HttpRequest) RequestJsonMap(router string, params interface{}) (JsonMap, error)

func (*HttpRequest) RequestPost

func (r *HttpRequest) RequestPost(router string, data []byte, header map[string]string) ([]byte, error)

type HttpRequestAsync

type HttpRequestAsync struct {
	// contains filtered or unexported fields
}
var HttpGetAsync *HttpRequestAsync
var HttpPostAsync *HttpRequestAsync

func NewHttpRequestAsync

func NewHttpRequestAsync(host string, reqType string) *HttpRequestAsync

func (*HttpRequestAsync) HandleHttpResponse

func (r *HttpRequestAsync) HandleHttpResponse()

func (*HttpRequestAsync) Release

func (r *HttpRequestAsync) Release()

func (*HttpRequestAsync) Request

func (r *HttpRequestAsync) Request(router string, params interface{}, respHandler RespHandler, errHandler RespErrorHandler)

func (*HttpRequestAsync) RequestGet

func (r *HttpRequestAsync) RequestGet(router string, header map[string]string, respHandler RespHandler, errHandler RespErrorHandler)

func (*HttpRequestAsync) RequestJsonArray

func (r *HttpRequestAsync) RequestJsonArray(router string, params interface{}, respHandler RespHandler, errHandler RespErrorHandler)

func (*HttpRequestAsync) RequestJsonMap

func (r *HttpRequestAsync) RequestJsonMap(router string, params interface{}, respHandler RespHandler, errHandler RespErrorHandler)

func (*HttpRequestAsync) RequestPost

func (r *HttpRequestAsync) RequestPost(router string, data []byte, header map[string]string, respHandler RespHandler, errHandler RespErrorHandler)

type HttpResponse

type HttpResponse struct {
	Header map[string]string
	Body   interface{}
}

func (*HttpResponse) SetHeader

func (h *HttpResponse) SetHeader(key string, value string)

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}

func NewHttpServer

func NewHttpServer() *HttpServer

func (*HttpServer) RegisterRouter

func (h *HttpServer) RegisterRouter(router string, handler RequestHandler)

func (*HttpServer) StartServer

func (h *HttpServer) StartServer(uri string)

func (*HttpServer) StopServer

func (h *HttpServer) StopServer()

type JsonArray

type JsonArray []interface{}

func (JsonArray) Get

func (this JsonArray) Get(i int) JsonObject

======================json arrays==============================================

func (JsonArray) GetArray

func (this JsonArray) GetArray(i int) JsonArray

func (JsonArray) GetInt

func (this JsonArray) GetInt(i int) int

func (JsonArray) GetMap

func (this JsonArray) GetMap(i int) JsonMap

func (JsonArray) GetStr

func (this JsonArray) GetStr(i int) string

func (JsonArray) GetUint

func (this JsonArray) GetUint(i int) uint

type JsonMap

type JsonMap map[string]interface{}

func (JsonMap) Get

func (this JsonMap) Get(key string) JsonObject

======================json map==============================================

func (JsonMap) GetArray

func (this JsonMap) GetArray(key string) JsonArray

func (JsonMap) GetBool

func (this JsonMap) GetBool(key string) bool

func (JsonMap) GetErrorKeys

func (this JsonMap) GetErrorKeys() string

func (JsonMap) GetInt

func (this JsonMap) GetInt(key string) int

func (JsonMap) GetInt64

func (this JsonMap) GetInt64(key string) int64

func (JsonMap) GetMap

func (this JsonMap) GetMap(key string) JsonMap

func (JsonMap) GetStr

func (this JsonMap) GetStr(key string) string

func (JsonMap) GetUint

func (this JsonMap) GetUint(key string) uint

func (JsonMap) GetUint64

func (this JsonMap) GetUint64(key string) uint64

func (JsonMap) ToUrl

func (this JsonMap) ToUrl(sb *StringBuilder)

func (JsonMap) WriteToHttp

func (this JsonMap) WriteToHttp(writer http.ResponseWriter) error

type JsonObject

type JsonObject interface{}

type JsonType

type JsonType struct{}
var JsonHelper JsonType

func (*JsonType) DataToBytes

func (this *JsonType) DataToBytes(data interface{}) ([]byte, error)

func (*JsonType) Marshal

func (this *JsonType) Marshal(obj JsonObject) ([]byte, error)

func (*JsonType) Unmarshal

func (this *JsonType) Unmarshal(bytes []byte) (JsonObject, error)

func (*JsonType) UnmarshalArray

func (this *JsonType) UnmarshalArray(bytes []byte) (JsonArray, error)

func (*JsonType) UnmarshalMap

func (this *JsonType) UnmarshalMap(bytes []byte) (JsonMap, error)

type RequestAsyncRet

type RequestAsyncRet struct {
	// contains filtered or unexported fields
}

type RequestHandler

type RequestHandler func(form *HttpForm) interface{}

type RespErrorHandler

type RespErrorHandler func(err error)

type RespHandler

type RespHandler func(reqResult *RequestAsyncRet)

Jump to

Keyboard shortcuts

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