response

package
v0.0.0-...-991bd03 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryCsv

func BinaryCsv(w http.ResponseWriter, filename string, b *bytes.Buffer)

func BinaryExcel

func BinaryExcel(w http.ResponseWriter, filename string, b *bytes.Buffer)

func BinaryPdf

func BinaryPdf(w http.ResponseWriter, filename string, b *bytes.Buffer)

func Error

func Error(w http.ResponseWriter, err error)

func OK

func OK(w http.ResponseWriter, data interface{})

func Paging

func Paging(w http.ResponseWriter, data interface{}, page int, limit int, cnt int64)

func UnauthorizedError

func UnauthorizedError(w http.ResponseWriter)

Types

type ErrorResponse

type ErrorResponse struct {
	Code    constant.InternalCode `json:"code"`
	Status  int                   `json:"status"`
	Message string                `json:"message"`
	Details []string              `json:"details"`
}

type JsonResponse

type JsonResponse struct {
	Success bool            `json:"success"`
	Paging  *PagingResponse `json:"paging"`
	Data    interface{}     `json:"data"`
	Error   *ErrorResponse  `json:"error"`
}

type PagingResponse

type PagingResponse struct {
	Page  int   `json:"page"`
	Limit int   `json:"limit"`
	Count int64 `json:"count"`
	Total int   `json:"total"`
	Next  bool  `json:"next"`
	Prev  bool  `json:"prev"`
}

Jump to

Keyboard shortcuts

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