eye

package module
v0.0.0-...-360893f Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2016 License: Apache-2.0 Imports: 21 Imported by: 0

README

eye

dev

Documentation

Overview

*

  • rest返回值结构类型定义

Index

Constants

View Source
const (
	LevelDebug = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelNone
)
View Source
const VERSION = "1.0.0"

Variables

View Source
var (
	Env map[string]string //全局配置
)
View Source
var (
	HTTPMETHOD = map[string]string{
		"GET":     "GET",
		"POST":    "POST",
		"PUT":     "PUT",
		"DELETE":  "DELETE",
		"PATCH":   "PATCH",
		"OPTIONS": "OPTIONS",
		"HEAD":    "HEAD",
		"TRACE":   "TRACE",
		"CONNECT": "CONNECT",
	}
)
View Source
var LoggerLevel = map[string]int{
	"debug": LevelDebug,
	"info":  LevelInfo,
	"warn":  LevelWarn,
	"error": LevelError,
	"none":  LevelNone,
}

Functions

func NewEnv

func NewEnv(filename string)

func PrintGCSummary

func PrintGCSummary(w http.ResponseWriter, r *http.Request)

print gc information to io.Writer

func Run

func Run()

func StartPprof

func StartPprof()

启动pprof

Types

type App

type App struct {
	Handlers *ControllerRegistor
	Server   *http.Server
}
var (
	EyeApp *App
)

func NewApp

func NewApp() *App

func RESTRouter

func RESTRouter(rootpath string, c IController) *App

func Router

func Router(rootpath string, c IController, mappingMethods ...string) *App

func (*App) Run

func (p *App) Run()

type Controller

type Controller struct {
	AppController interface{}
	Req           *context.Context
	Resp          []map[interface{}]interface{}
	// contains filtered or unexported fields
}

func (*Controller) Delete

func (p *Controller) Delete()

func (*Controller) Display

func (p *Controller) Display() error

func (*Controller) Finish

func (p *Controller) Finish()

func (*Controller) Get

func (p *Controller) Get()

func (*Controller) HandlerFunc

func (p *Controller) HandlerFunc(fn string) bool

func (*Controller) Head

func (p *Controller) Head()

func (*Controller) Init

func (p *Controller) Init(context *context.Context, actionName string, app IController)

func (*Controller) Name

func (p *Controller) Name() string

func (*Controller) Options

func (p *Controller) Options()

func (*Controller) Patch

func (p *Controller) Patch()

func (*Controller) Post

func (p *Controller) Post()

func (*Controller) Prepare

func (p *Controller) Prepare()

func (*Controller) Put

func (p *Controller) Put()

type ControllerRegistor

type ControllerRegistor struct {
	Mux map[string]*routerItem
}

func NewControllerRegister

func NewControllerRegister() *ControllerRegistor

func (*ControllerRegistor) Add

func (p *ControllerRegistor) Add(rootpath string, c IController, mappingMethods ...string)

func (*ControllerRegistor) Path

func (p *ControllerRegistor) Path(path string) string

func (*ControllerRegistor) ServeHTTP

func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type IController

type IController interface {
	Init(context *context.Context, actionName string, app IController)
	Prepare()
	Get()
	Post()
	Delete()
	Put()
	Head()
	Patch()
	Options()
	Finish()
	Display() error
	HandlerFunc(fn string) bool
	Name() string
}

type IRestCtx

type IRestCtx interface {
	Prepare()
	JsonByte()
	JsonString()
}

type RedisSvc

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

func NewRedis

func NewRedis(redis_host string, redis_port string, redis_auth string, redis_db int, enablePool bool) *RedisSvc

func (*RedisSvc) ActiveCount

func (p *RedisSvc) ActiveCount() int

func (*RedisSvc) DoCmd

func (p *RedisSvc) DoCmd(cmd string, args ...interface{}) (interface{}, error)

type RestCtx

type RestCtx struct {
	Errno  int    `json:"error"`
	Errmsg string `json:"errmsg"`
	Count  int    `json:"count"`
	// contains filtered or unexported fields
}

func (*RestCtx) JsonByte

func (p *RestCtx) JsonByte() ([]byte, error)

结构体转化json byte数据

func (*RestCtx) JsonString

func (p *RestCtx) JsonString() (string, error)

结构体转化json string数据

func (*RestCtx) Prepare

func (p *RestCtx) Prepare()

type XLogger

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

func Log

func Log(tag string) *XLogger

func NewLogger

func NewLogger(tag string) *XLogger

func (*XLogger) Debug

func (this *XLogger) Debug(str string, evts ...string)

func (*XLogger) Error

func (this *XLogger) Error(str string, evts ...string)

func (*XLogger) Info

func (this *XLogger) Info(str string, evts ...string)

func (*XLogger) Logger

func (this *XLogger) Logger() *syslog.Writer

func (*XLogger) Warn

func (this *XLogger) Warn(str string, evts ...string)

Directories

Path Synopsis
Usage: ctx := context.Context{Request:req,ResponseWriter:rw}
Usage: ctx := context.Context{Request:req,ResponseWriter:rw}
demo
* * 数据存储定义 * @author dzh * @date 2015-08-05 * * 数据存储定义 * @author dzh * @date 2015-08-05
* * 数据存储定义 * @author dzh * @date 2015-08-05 * * 数据存储定义 * @author dzh * @date 2015-08-05
endless provides a drop in replacement for the `net/http` stl functions `ListenAndServe` and `ListenAndServeTLS` to achieve zero downtime restarts and code upgrades.
endless provides a drop in replacement for the `net/http` stl functions `ListenAndServe` and `ListenAndServeTLS` to achieve zero downtime restarts and code upgrades.

Jump to

Keyboard shortcuts

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