libgin

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 4 Imported by: 37

README

libgin

Starter for building web, including RESTful, applications using Gin

Documentation

Index

Constants

View Source
const (
	GroupREST   = "rest"
	GroupStatic = "static"
)

定义常用的分组名称

Variables

This section is empty.

Functions

func NewModule

func NewModule() *application.ModuleBuilder

NewModule 导出模块 github.com/starter-go/libgin

func NewModuleDevtools

func NewModuleDevtools() *application.ModuleBuilder

NewModuleDevtools 导出模块 [github.com/starter-go/libgin#devtools]

Types

type Connector

type Connector interface {
	Registration() *ConnectorRegistration
}

Connector ...

type ConnectorRegistration

type ConnectorRegistration struct {
	Name      string
	Connector Connector
}

ConnectorRegistration ...

type ContentTypeManager

type ContentTypeManager interface {
	FindTypeBySuffix(suffix string) (string, error)
}

ContentTypeManager 是文档类型管理器

type ContentTypeRegistration

type ContentTypeRegistration struct {
	ContentType string
	Suffixes    []string
}

ContentTypeRegistration 是文档类型信息

type ContentTypeRegistry

type ContentTypeRegistry interface {
	ListRegistrations() []*ContentTypeRegistration
}

ContentTypeRegistry 是文档类型登记接口

type Context

type Context interface {
	GetConnectorByName(name string) (Connector, error)
	GetGroupByName(name string) (Group, error)
	GetRouterByName(name string) (Router, error)
	ListControllersForGroup(groupName string) ([]*ControllerRegistration, error)
}

Context 是 libgin 上下文,它集中管理各种 libgin 资源

type Controller

type Controller interface {
	Registration() *ControllerRegistration
}

Controller 表示一个 gin 控制器

type ControllerRegistration

type ControllerRegistration struct {
	Groups []string                       // 分组名称, 以 ',' 号分隔多个名称,如果为空表示默认分组
	Route  func(g *gin.RouterGroup) error // 控制器

}

ControllerRegistration 是控制器注册信息

type Group

type Group interface {
	Registration() *GroupRegistration
	Route(r Router) error
}

Group ...

type GroupRegistration

type GroupRegistration struct {
	Name  string
	Path  string
	Group Group
}

GroupRegistration ...

type Responder

type Responder interface {
	Send(resp *Response)
}

Responder 是 REST 响应发送器的接口

type Response

type Response struct {
	Context *gin.Context
	Status  int
	Error   error
	Data    any
}

Response 表示一个 REST 响应结果

type Router

type Router interface {
	Registration() *RouterRegistration
	Engine() *gin.Engine
}

Router ...

type RouterRegistration

type RouterRegistration struct {
	Name   string
	Router Router
}

RouterRegistration ...

Directories

Path Synopsis
devtools
xos
gen
src
configen command
demo command
devtools command

Jump to

Keyboard shortcuts

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