gin_x

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendResponse

func SendResponse(ctx *gin.Context, httpCode int, data interface{})

SendResponse setting gin.JSON

func SendResponseError

func SendResponseError(ctx *gin.Context, httpCode int, data interface{})

SendResponseError setting gin.JSON

func SendResponseErrorString

func SendResponseErrorString(ctx *gin.Context, httpCode int, data interface{}, err error)

func SendResponseString

func SendResponseString(ctx *gin.Context, httpCode int, format string, data *string)

func SendResponseValidationError

func SendResponseValidationError(ctx *gin.Context, httpCode int, err error)

SendResponseValidationError setting gin.JSON

Types

type HttpServer

type HttpServer struct {
	Name        string
	Host        string
	Port        int
	Engine      *gin.Engine
	Environment string
}

func NewHttpServer

func NewHttpServer(name string) *HttpServer

NewHttpServer returns an instance of

func (*HttpServer) LoadFromConfig

func (server *HttpServer) LoadFromConfig(key string, config *viper.Viper)

LoadFromConfig reads the conf for settings

type Response

type Response struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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