server

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAutoSql

func AddAutoSql(name string, sqlStr string)

添加SQL脚本

func AddAutoTable

func AddAutoTable(name string, table interface{})

添加需要自动检查的表

Types

type GranadaServer

type GranadaServer struct {

	// 服务接口基础路由组
	ApiBase *gin.RouterGroup
	// 服务接口版本
	ApiVersion *gin.RouterGroup
	// 路由信息
	RGMap map[string]*RouterGroupInfo
	// 鉴权中间件
	AuthMid *jwt.GinJWTMiddleware
	// contains filtered or unexported fields
}

服务主体

func NewGranadaServer

func NewGranadaServer(name string) *GranadaServer

初始化对象

func (*GranadaServer) AddGroup

func (gs *GranadaServer) AddGroup(name, remarks string) *RouterGroupInfo

添加一个路由组

func (*GranadaServer) InitServer

func (gs *GranadaServer) InitServer()

初始化服务

func (*GranadaServer) RestartServer

func (gs *GranadaServer) RestartServer()

重启服务

func (*GranadaServer) RunServer

func (gs *GranadaServer) RunServer()

运行服务

func (*GranadaServer) Shutdown

func (gs *GranadaServer) Shutdown()

关闭服务

type Method

type Method int64
const (
	GET Method = iota
	POST
	PUT
	PATCH
	DELETE
	HEAD
	CONNECT
	OPTIONS
	Any
)

type RouterGroupInfo

type RouterGroupInfo struct {
	// 备注
	Remarks string
	// 路由组
	GGroup *gin.RouterGroup
	// 路由
	RouterInfo map[string]*RouterInfo
	// 子路由信息
	ChildRouterGroup map[string]*RouterGroupInfo
}

路由组信息

func (*RouterGroupInfo) AddGroup

func (gpi *RouterGroupInfo) AddGroup(name, remarks string) *RouterGroupInfo

添加一个路由组

func (*RouterGroupInfo) AddRouter

func (gpi *RouterGroupInfo) AddRouter(method Method, name, remarks string, Handler ...gin.HandlerFunc)

添加路由

type RouterInfo

type RouterInfo struct {
	// 调用方法
	Method Method
	// 备注
	Remarks string
	// 对应方法
	Handler []gin.HandlerFunc
}

路由信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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