http

package
v0.0.0-...-5495d05 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceOKCode = 0
)

Variables

This section is empty.

Functions

func GetPostedJson

func GetPostedJson(ctx *gin.Context, output interface{}) (rawData []byte, err error)

func RegisterMiddleware

func RegisterMiddleware(before []gin.HandlerFunc, after []AfterHandler)

Types

type AfterHandler

type AfterHandler func(result *ServiceResult, res *Response)

type BeforeHandler

type BeforeHandler gin.HandlerFunc

type Config

type Config struct {
	Address        string          `json:"address"`
	RouteRegisters []RouteRegister `json:"-"`

	LogFile string `json:"log_file"`
}

type Response

type Response struct {
	// contains filtered or unexported fields
}

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func (*Response) JSON

func (c *Response) JSON(data interface{})

func (*Response) ServiceResult

func (c *Response) ServiceResult(code int64, msg string, data interface{})

func (*Response) Success

func (c *Response) Success(data interface{})

type RouteRegister

type RouteRegister func(router gin.IRouter)

type Server

type Server struct {
	Config *Config
}

func (*Server) Start

func (s *Server) Start(wg *sync.WaitGroup) (*sync.WaitGroup, error)

type ServiceResult

type ServiceResult struct {
	Code    int64       `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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