jsonutil

package
v0.0.0-...-616be86 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalResponse

func MarshalResponse(w http.ResponseWriter, status int, response interface{})

MarshalResponse to client.

func Unmarshal

func Unmarshal(w http.ResponseWriter, r *http.Request, data interface{}) (int, error)

Unmarshal request.

Types

type Error

type Error struct {
	ErrorCode int    `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

Error struct.

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error"`
}

ErrorResponse struct.

func NewError

func NewError(code int, msg string) ErrorResponse

NewError create new ErrorResponse.

type SuccessfulResponse

type SuccessfulResponse struct {
	Response interface{} `json:"response"`
}

SuccessfulResponse struct.

func NewSuccessfulResponse

func NewSuccessfulResponse(response interface{}) SuccessfulResponse

NewSuccessfulResponse create new SuccessfulResponse.

Jump to

Keyboard shortcuts

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