Documentation ¶
Overview ¶
Package httpexec provides the executor for the HTTP request.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecReq ¶
type ExecReq interface { // CreateRequest creates the http.Request object for the query CreateRequest(ctx context.Context, log logger.Logger, count int) (*http.Request, error) }
ExecReq represents the request executor
type MassRequestContent ¶
type MassRequestContent[Req ExecReq] struct { Req Req Interval time.Duration ResponseWait bool ResChan chan<- ResponseContent CountLimit RequestCountLimit ResponseType ResponseType }
MassRequestContent represents the request content
func (MassRequestContent[Req]) MassRequestExecute ¶
func (q MassRequestContent[Req]) MassRequestExecute( ctx context.Context, log logger.Logger, ) error
MassRequestExecute executes the request
type MassRequestExecutor ¶
type MassRequestExecutor interface { // MassRequestExecute executes the request MassRequestExecute(ctx context.Context, log logger.Logger) error }
MassRequestExecutor represents the request executor
type RequestContent ¶
type RequestContent[Req ExecReq] struct { Req Req ResponseType ResponseType }
RequestContent represents the request content
func (RequestContent[Req]) RequestExecute ¶
func (q RequestContent[Req]) RequestExecute( ctx context.Context, log logger.Logger, ) (ResponseContent, error)
RequestExecute executes the request
type RequestCountLimit ¶
RequestCountLimit represents the request count limit
type RequestExecutor ¶
type RequestExecutor interface { // RequestExecute executes the request RequestExecute(ctx context.Context, log logger.Logger) (ResponseContent, error) }
RequestExecutor represents the request executor
type ResponseContent ¶
type ResponseContent struct { Success bool StartTime time.Time EndTime time.Time Res any Count int ByteResponse []byte ResponseTime int64 StatusCode int ReqCreateHasErr bool ParseResHasErr bool HasSystemErr bool WithCountLimit bool }
ResponseContent represents the response content
func (ResponseContent) ToWriteHTTPData ¶
func (r ResponseContent) ToWriteHTTPData() WriteHTTPData
ToWriteHTTPData converts the ResponseContent to WriteHTTPData
type ResponseType ¶
type ResponseType string
ResponseType represents the response type
const ( // ResponseTypeJSON represents the JSON response type ResponseTypeJSON ResponseType = "json" // ResponseTypeXML represents the XML response type ResponseTypeXML ResponseType = "xml" // ResponseTypeYAML represents the YAML response type ResponseTypeYAML ResponseType = "yaml" // ResponseTypeText represents the text response type ResponseTypeText ResponseType = "text" // ResponseTypeHTML represents the HTML response type ResponseTypeHTML ResponseType = "html" )
type WriteHTTPData ¶
type WriteHTTPData struct { Success bool SendDatetime string ReceivedDatetime string Count int ResponseTime int StatusCode string }
WriteHTTPData represents the data to be written
func (WriteHTTPData) ToSlice ¶
func (d WriteHTTPData) ToSlice() []string
ToSlice converts the WriteHTTPData to a slice