Documentation ¶
Index ¶
- func MakeTimestamp() int64
- func ParseBodyToMap(r *http.Request) (map[string]string, errors.EdgeX)
- func ParseGetAllObjectsRequestQueryString(r *http.Request, minOffset int, maxOffset int, minLimit int, maxLimit int) (offset int, limit int, labels []string, err errors.EdgeX)
- func ParsePathParamToInt(r *http.Request, pathKey string) (int, errors.EdgeX)
- func ParseQueryStringToInt(r *http.Request, queryStringKey string, defaultValue int, min int, max int) (int, errors.EdgeX)
- func ParseQueryStringToString(r *http.Request, queryStringKey string, defaultValue string) string
- func ParseQueryStringToStrings(r *http.Request, queryStringKey string, separator string) (stringArray []string)
- func ParseTimeRangeOffsetLimit(r *http.Request, minOffset int, maxOffset int, minLimit int, maxLimit int) (start int, end int, offset int, limit int, edgexErr errors.EdgeX)
- func SendRequestWithRESTAddress(lc logger.LoggingClient, content string, contentType string, ...) (res string, err errors.EdgeX)
- func WriteErrorResponse(w http.ResponseWriter, ctx context.Context, lc logger.LoggingClient, ...)
- func WriteHttpHeader(w http.ResponseWriter, ctx context.Context, statusCode int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeTimestamp ¶
func MakeTimestamp() int64
MakeTimestamp returns the Unix timestamp in milliseconds
func ParseBodyToMap ¶
Parse the body of http request to a map[string]string. EdgeX error will be returned if any parsing error occurs.
func ParseGetAllObjectsRequestQueryString ¶
func ParseGetAllObjectsRequestQueryString(r *http.Request, minOffset int, maxOffset int, minLimit int, maxLimit int) (offset int, limit int, labels []string, err errors.EdgeX)
ParseGetAllObjectsRequestQueryString parses offset, limit and labels from the query parameters. And use maximum and minimum to check whether the offset and limit are valid.
func ParsePathParamToInt ¶
Parse the specified path parameter to an integer. EdgeX error will be returned if any parsing error occurs or specified path parameter is empty.
func ParseQueryStringToInt ¶
func ParseQueryStringToInt(r *http.Request, queryStringKey string, defaultValue int, min int, max int) (int, errors.EdgeX)
Parse the specified query string key to an integer. If specified query string key is found more than once in the http request, only the first specified query string will be parsed and converted to an integer. If no specified query string key could be found in the http request, specified default value will be returned. EdgeX error will be returned if any parsing error occurs.
func ParseQueryStringToString ¶
Parse the specified query string key to a string. If specified query string key is found more than once in the http request, only the first specified query string will be parsed and converted to a string. If no specified query string could be found, defaultValue will be returned.
func ParseQueryStringToStrings ¶
func ParseQueryStringToStrings(r *http.Request, queryStringKey string, separator string) (stringArray []string)
Parse the specified query string key to an array of string. If specified query string key is found more than once in the http request, only the first specified query string will be parsed and converted to an array of string. The value of query string will be split into an array of string by the passing separator. If separator is passed in as an empty string, comma separator will be used.
func SendRequestWithRESTAddress ¶
func SendRequestWithRESTAddress(lc logger.LoggingClient, content string, contentType string, address models.RESTAddress) (res string, err errors.EdgeX)
SendRequestWithRESTAddress sends request with REST address
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, ctx context.Context, lc logger.LoggingClient, err errors.EdgeX, requestId string)
WriteErrorResponse writes Http header, encode error response with JSON format and writes to the HTTP response.
func WriteHttpHeader ¶
func WriteHttpHeader(w http.ResponseWriter, ctx context.Context, statusCode int)
Types ¶
This section is empty.