helpers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package helpers are code saving utility and helper functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPResponseBuilder

func HTTPResponseBuilder(ctx context.Context, w http.ResponseWriter, r *http.Request, httpStatus int, message string, data interface{}, errorCode int)

HTTPResponseBuilder builds the response headers and payloads

func ParsePathParams

func ParsePathParams(template, path string) (map[string]string, error)

ParsePathParams parse request path param according to path template and extract its values.

Types

type ResponseJSON

type ResponseJSON struct {
	Message   string      `json:"message"`
	Status    string      `json:"status"`
	Data      interface{} `json:"data,omitempty"`
	ErrorCode int         `json:"error_code,omitempty"`
}

ResponseJSON define the structure of all response

Jump to

Keyboard shortcuts

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