package
1.12.6
Repository: https://github.com/go-dev-frame/sponge.git
Documentation: pkg.go.dev

# README

response

The wrapper gin returns json data in the same format.


Example of use

  • Output return a compatible http status code.
  • Success and Error return a uniform status code of 200, with a custom status code in data.code

all requests return a uniform json

{
  "code": 0,
  "msg": "",
  "data": {}
}
    // c is *gin.Context

    // return success
    response.Success(c)
    // return success and return data
    response.Success(c, gin.H{"users":users})

    // return failure
    response.Error(c, errcode.SendEmailErr)
    // returns a failure and returns the data
    response.Error(c,  errcode.SendEmailErr, gin.H{"user":user})

# Functions

Error return error.
Out returns the standard HTTP status code and message, parameter err is errcode.Error.
Output return standard HTTP status codes and message, parameter code is HTTP status code.
Success return success.

# Structs

Result output data format.