utils

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQuery

func GetQuery(r *http.Request, key string, defaultValue ...string) string

GetQuery to get URL query with default value.

func ResponseWithJSON

func ResponseWithJSON(w http.ResponseWriter, code int, data interface{}, err error, meta ...map[string]interface{})

ResponseWithJSON to write response with JSON format.

Types

type Response

type Response struct {
	Status  int                    `json:"status"`
	Message string                 `json:"message"`
	Data    interface{}            `json:"data" swaggertype:"object"`
	Meta    map[string]interface{} `json:"meta" swaggertype:"object"`
}

Response is standard api response model.

Jump to

Keyboard shortcuts

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