http

package
v0.0.0-...-fdc5c16 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPostedJson

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

Types

type Config

type Config struct {
	Address        string            `json:"address"`
	BasePath       string            `json:"base_path"`
	EnableTLS      bool              `json:"enable_tls"`
	AllowCORS      bool              `json:"allow_cors"`
	RequestHandler []IRequestHandler `json:"-"`
}

type HandlerBasicInformation

type HandlerBasicInformation struct {
	Path        string
	Method      string
	Description string
	Parameters  Parameters
}

type IRequestHandler

type IRequestHandler interface {
	Handle(ctx *gin.Context)
	RouteRegister(router gin.IRouter)
	BasicInformation() (info HandlerBasicInformation)
}

type Parameters

type Parameters struct {
	Type     string
	Template interface{}
}

type Response

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

func NewResponse

func NewResponse(ctx *gin.Context) *Response

func (*Response) BadRequest

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

func (*Response) ForbiddenRequest

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

func (*Response) InternalServerError

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

func (*Response) NotFoundRequest

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

func (*Response) OK

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

func (*Response) ServiceError

func (c *Response) ServiceError(code int64, data interface{})

service response will always set http status to 200.

func (*Response) ServiceSuccess

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

type Server

type Server struct {
	Config *Config
}

func (*Server) Start

func (s *Server) Start() (err error)

type ServiceResult

type ServiceResult struct {
	Code    int64       `json:"code"`
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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