RWeb

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

RWeb

Ruixue web framework

仅为后端制作,不包含前端渲染等。

目标是作为瑞雪Go后端的统一web框架。

服务端为GO语言实现。目前服务端支持两种函数绑定方式:

函数第一个与第二个参数分别为*Replier,*Session

或者为只具有协定的参数,并通过RWeb.R(),RWeb.S()获取这两个值。

Documentation

Overview

Package RWeb @Title Engine.go @Description 引擎的主要实现文件 @Author Dorbmon

Index

Constants

View Source
const (
	MethodPost = iota
	MethodGet
	MethodHead
	MethodPut
	MethodPatch
	MethodDelete
	MethodConnect
	MethodOptions
	MethodTrace
	MethodAll
	MethodUnknown
)

Variables

This section is empty.

Functions

func RemoveContext

func RemoveContext(context *Context)

func ToRWebMethod

func ToRWebMethod(Method []byte) int

Types

type Context

type Context struct {
	RequestUri string
	Method     int
	RawCtx     *fasthttp.RequestCtx
}

func CtxToContext

func CtxToContext(ctx *fasthttp.RequestCtx) *Context

func NewContext

func NewContext() (ret *Context)

func (*Context) Cookie added in v0.1.3

func (z *Context) Cookie(key string) []byte

func (*Context) DefaultQuery added in v0.1.3

func (z *Context) DefaultQuery(key string, defaultValue string) string

func (*Context) FormFile added in v0.1.3

func (z *Context) FormFile(key string) (*multipart.FileHeader, error)

func (*Context) FormValue added in v0.0.9

func (z *Context) FormValue(key string) []byte

func (*Context) Json added in v0.1.3

func (z *Context) Json(data interface{}) error

func (*Context) MultipartForm added in v0.1.3

func (z *Context) MultipartForm() (*multipart.Form, error)

func (*Context) Query added in v0.1.3

func (z *Context) Query(key string) string

func (*Context) Redirect added in v0.1.3

func (z *Context) Redirect(uri string, statusCode int)

func (*Context) SaveUploadedFile added in v0.1.3

func (z *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error

func (*Context) String added in v0.1.3

func (z *Context) String(data string) error

func (*Context) Write added in v0.0.10

func (z *Context) Write(data []byte) error

type DefaultLog

type DefaultLog struct {
}

func (*DefaultLog) FrameworkPrintMessage

func (z *DefaultLog) FrameworkPrintMessage(Module, Message string, Level int)

type DefaultRouter

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

func NewDefaultRouter

func NewDefaultRouter() (r DefaultRouter)

func (*DefaultRouter) AddInterceptor added in v0.0.8

func (z *DefaultRouter) AddInterceptor(interceptor Interceptor)

func (*DefaultRouter) Bind

func (z *DefaultRouter) Bind(address string, method int, handler Handler) error

func (*DefaultRouter) BindSubRouter

func (z *DefaultRouter) BindSubRouter(other Router)

func (*DefaultRouter) GetFromSubRouter

func (z *DefaultRouter) GetFromSubRouter(context *Context) Handler

func (*DefaultRouter) GetHandler

func (z *DefaultRouter) GetHandler(context *Context) Handler

func (*DefaultRouter) LoadFromRouter added in v0.0.6

func (z *DefaultRouter) LoadFromRouter(other Router)

func (*DefaultRouter) OutputRules added in v0.0.6

func (z *DefaultRouter) OutputRules() []*RouterHandler

func (*DefaultRouter) SetBasicRoute added in v0.0.7

func (z *DefaultRouter) SetBasicRoute(basic string)

type Engine

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

func NewEngine

func NewEngine(router Router) (e Engine)

func (*Engine) RunAndServe

func (z *Engine) RunAndServe(address string) error

func (*Engine) RunAndServeTLS added in v0.1.2

func (z *Engine) RunAndServeTLS(address string, certData, keyData []byte) error

func (*Engine) SetRouter

func (z *Engine) SetRouter(router Router)

type Handler

type Handler func(context *Context)

type Interceptor added in v0.0.8

type Interceptor func(context *Context) bool //为false的时候,将阻断调用

type Log

type Log interface {
	//Level 为信息等级,绝对值越小,信息越不重要。框架输出使用负数
	//Module 表示模块
	FrameworkPrintMessage(Module, Message string, Level int)
}

type Router

type Router interface {
	Bind(address string, method int, handler Handler) error
	GetHandler(context *Context) Handler
	BindSubRouter(Router)  // 挂载子路由
	LoadFromRouter(Router) // 复制子路由的数据
	OutputRules() []*RouterHandler
	AddInterceptor(interceptor Interceptor)
}

type RouterHandler added in v0.0.6

type RouterHandler struct {
	Address string
	Handler Handler
	Method  int
}

Directories

Path Synopsis
@Title WebsocketDealer.go @Description 实现websocket低成本call 需要客户端配合 @Author Dorbmon
@Title WebsocketDealer.go @Description 实现websocket低成本call 需要客户端配合 @Author Dorbmon

Jump to

Keyboard shortcuts

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