http_binding

package
v1.3.11-alpha1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind[I any, O any](b *Binding, item *BindItem[I, O], middlewares ...middleware.Func)

func DeleteBind

func DeleteBind[I any, O any](b *Binding, item *SimpleBindItem[I, O], middlewares ...middleware.Func)

func Destroy

func Destroy()

func GetBind

func GetBind[I any, O any](b *Binding, item *SimpleBindItem[I, O], middlewares ...middleware.Func)

func GetRouter

func GetRouter() *gin.Engine

func Init

func Init(apiUrlPrefix string, port string)

func PostBind

func PostBind[I any, O any](b *Binding, item *SimpleBindItem[I, O], middlewares ...middleware.Func)

func PutBind

func PutBind[I any, O any](b *Binding, item *SimpleBindItem[I, O], middlewares ...middleware.Func)

func Static

func Static(b *Binding, item *StaticBindItem)

func StaticFile added in v1.2.6

func StaticFile(b *Binding, item *StaticFileBindItem)

Types

type BindItem

type BindItem[I any, O any] struct {
	Method string
	*SimpleBindItem[I, O]
}

BindItem 路由条目结构

type Binding

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

func NewBinding

func NewBinding(apiVersion string, middlewares ...middleware.Func) *Binding

NewBinding 创建版本对应的binding

func (*Binding) AddHandler added in v1.2.5

func (binding *Binding) AddHandler(method string, relativePath string, handleFunctions ...HandleFunc) error

type BindingFunc

type BindingFunc[O any] func(c *binding_context.Context, request any, sendFunc response.SendFunc[O]) bool

type BusinessFunc

type BusinessFunc[I any, O any] func(c *binding_context.Context, inputModel I) (O, error)

type HandleFunc added in v1.2.5

type HandleFunc func(c *binding_context.Context)

type SimpleBindItem

type SimpleBindItem[I any, O any] struct {
	Path                string               // 请求路径
	ResponseFunc        response.SendFunc[O] // 响应泛型函数
	BusinessFunc        BusinessFunc[I, O]   // 业务泛型函数
	OptionalBindingFunc BindingFunc[O]       // 可选的绑定函数
}

SimpleBindItem 路由条目

type StaticBindItem

type StaticBindItem struct {
	RelativePath string
	Root         string
	WithBasePath bool
}

StaticBindItem 静态路由item

type StaticFileBindItem added in v1.2.6

type StaticFileBindItem struct {
	RelativePath string
	FilePath     string
	WithBasePath bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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