server

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SuccessCode = 200
	FailCode    = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Writer  http.ResponseWriter
	Request *http.Request
	Param   *RunReq
	TraceId string
	// contains filtered or unexported fields
}

func (*Context) Copy

func (ctx *Context) Copy() *Context

func (*Context) Deadline

func (ctx *Context) Deadline() (deadline time.Time, ok bool)

func (*Context) Done

func (ctx *Context) Done() <-chan struct{}

func (*Context) Err

func (ctx *Context) Err() error

func (*Context) Fail

func (ctx *Context) Fail(msg string, data interface{})

func (*Context) Get

func (ctx *Context) Get(key string) (value interface{}, exist bool)

func (*Context) GetInt64

func (ctx *Context) GetInt64(key string) int64

func (*Context) GetInt64OrDefault

func (ctx *Context) GetInt64OrDefault(key string, defaultValue int64) int64

func (*Context) GetString

func (ctx *Context) GetString(key string) string

func (*Context) GetStringOrDefault

func (ctx *Context) GetStringOrDefault(key, defaultValue string) string

func (*Context) GetTraceId

func (ctx *Context) GetTraceId() string

func (*Context) JSON

func (ctx *Context) JSON(code int, data []byte)

func (*Context) Reset added in v0.0.2

func (ctx *Context) Reset() *Context

Reset reset ctx

func (*Context) Set

func (ctx *Context) Set(key string, value interface{})

func (*Context) SetTraceId

func (ctx *Context) SetTraceId(traceId string)

func (*Context) String

func (ctx *Context) String() string

func (*Context) Success

func (ctx *Context) Success(msg string, data interface{})

func (*Context) Value

func (ctx *Context) Value(key interface{}) interface{}

type Engine

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

func New

func New() *Engine

func (*Engine) AddRoute

func (engine *Engine) AddRoute(path string, handler Handler)

AddRoute add web endpoint

func (*Engine) Run

func (engine *Engine) Run(addr ...string) error

func (*Engine) ServeHTTP

func (engine *Engine) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Engine) SetAfterHandler

func (engine *Engine) SetAfterHandler(handlers ...Handler)

func (*Engine) SetBeforeHandlers

func (engine *Engine) SetBeforeHandlers(handlers ...Handler)

type Handler

type Handler func(ctx *Context)

type Resp

type Resp struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Content interface{} `json:"content"`
}

type RunReq

type RunReq struct {
	JobID                 int64  `json:"jobId"`
	ExecutorHandler       string `json:"executorHandler"`
	ExecutorParams        string `json:"executorParams"`
	ExecutorBlockStrategy string `json:"executorBlockStrategy"`
	ExecutorTimeout       int64  `json:"executorTimeout"`
	LogID                 int64  `json:"logId"`
	LogDateTime           int64  `json:"logDateTime"`
	GlueType              string `json:"glueType"`
	GlueSource            string `json:"glueSource"`
	GlueUpdatetime        int64  `json:"glueUpdatetime"`
	BroadcastIndex        int64  `json:"broadcastIndex"`
	BroadcastTotal        int64  `json:"broadcastTotal"`
}

Jump to

Keyboard shortcuts

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