utils

package
v0.0.0-...-27aa214 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package utils implements generic utilities for api

Package utils implements generic utilities for api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendHTTPError

func SendHTTPError(status int, err error, w http.ResponseWriter)

SendHTTPError sends http error to client

func SendHTTPResponse

func SendHTTPResponse(data interface{}, status int, w http.ResponseWriter)

SendHTTPResponse sends http response to client

Types

type HTTPError

type HTTPError struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

HTTPError struct defines fields for http error

type HTTPResponse

type HTTPResponse struct {
	Status int         `json:"status"`
	Data   interface{} `json:"data"`
}

HTTPResponse struct defines fields for http error

Jump to

Keyboard shortcuts

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