ginsrv

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrRespJson

func ErrRespJson(c *gin.Context, code int, msg string)

func GetLocalBoundIP added in v1.0.7

func GetLocalBoundIP() string

func NewGroups

func NewGroups(gp ...string) map[string]*Group

func Run

func Run(gs map[string]*Group, p ...string) error

func RunWithNoGroup

func RunWithNoGroup(ip, port string, rs ...Route)

func SetStatic

func SetStatic(p string)

func TestHandle

func TestHandle(rs []*Route) *gin.Engine

Types

type Group

type Group struct {
	Path string

	Router *gin.RouterGroup
	// contains filtered or unexported fields
}

func (*Group) AddRoute

func (my *Group) AddRoute()

func (*Group) SetRoutes

func (my *Group) SetRoutes(route ...Route)

type Info

type Info struct {
	Addr string `json:"domain"`
	Port string `json:"port"`
	// Rs     []Route		//routes
	Gs     []*Group //groups
	Engine *gin.Engine
}

func Init

func Init(p ...string) (*Info, error)

type Resp

type Resp struct {
	ErrNum int         `json:"errcode"`
	ErrMsg string      `json:"errmsg"`
	Data   interface{} `json:"data"`
}

type Route

type Route struct {
	Method  string
	Path    string
	Handler gin.HandlerFunc
}

Jump to

Keyboard shortcuts

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