api

package
v0.0.0-...-0248c43 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitAndSelect

func SplitAndSelect(s, seq string, index int) string

SplitAndSelect 分割并选择其中一段 @param index 分割后数组的下标,支持负数,负数为倒序获取,超过数组的部分下标

func Start

func Start(config config.ApiConfig)

Start 根据配置参数启动Api服务

Types

type Context

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

func (*Context) Four04

func (c *Context) Four04()

func (*Context) URISubSelect

func (c *Context) URISubSelect(index int) string

func (*Context) Write

func (c *Context) Write(bytes []byte) error

func (*Context) WriteError

func (c *Context) WriteError(err error) error

func (*Context) WriteJson

func (c *Context) WriteJson(i interface{}) (err error)

func (*Context) WriteString

func (c *Context) WriteString(s string) error

type HandlerFunc

type HandlerFunc func(Context)

type RestHandler

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

func (*RestHandler) Add

func (rest *RestHandler) Add(method, url string, handlerFunc http.Handler)

Add 注册GET方法处理器 如果url以`r:`开头,说明是一个正则表达式路径

func (*RestHandler) Delete

func (rest *RestHandler) Delete(url string, handler http.Handler)

Delete 注册DELETE方法处理器

func (*RestHandler) Get

func (rest *RestHandler) Get(url string, handler http.Handler)

Get 注册GET方法处理器

func (*RestHandler) Post

func (rest *RestHandler) Post(url string, handler http.Handler)

Post 注册POST方法处理器

func (*RestHandler) Put

func (rest *RestHandler) Put(url string, handler http.Handler)

Put 注册PUT方法处理器

func (*RestHandler) ServeHTTP

func (rest *RestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP 实现Handle接口

Jump to

Keyboard shortcuts

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