Documentation ¶
Index ¶
- Variables
- func NewTrace() string
- func Reg(stype string, factory ServiceFactory)
- func WithContext(c context.Context, ctx Context) context.Context
- type Context
- type Executor
- type HttpContent
- type IScheme
- type Key
- type Payload
- type Recycle
- type Runtime
- type Scheme
- type SchemeField
- type SchemeItem
- type SchemeObject
- type Service
- type ServiceFactory
- type Step
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKey = Key{}
Functions ¶
Types ¶
type Context ¶
type Context interface { Recycle Id() string Path() string Trace() string GetValue(key string) string SetValue(key string, value string) Each(fn func(key string, value string) bool) /** * 增加计数,用户统计 **/ AddCount(key string, count int) AddTag(key string, value string) GetService(name string) (Service, error) Runtime() Runtime Payload() Payload /** * 日志 **/ Println(v ...interface{}) Printf(format string, v ...interface{}) Step(step string) Step BeginStep(step string) EndStep(format string, v ...interface{}) Ctx() context.Context WithValue(key interface{}, value interface{}) context.Context }
*
- 上下文 *
func GetContext ¶
type HttpContent ¶ added in v1.0.26
type HttpContent struct { Code int `json:"code"` Headers map[string]string `json:"headers"` Body []byte `json:"body"` }
func (*HttpContent) Error ¶ added in v1.0.26
func (s *HttpContent) Error() string
type Runtime ¶
type Runtime interface { /** * 配置信息 **/ Config() interface{} /** * 名称 **/ Name() string /** * 节点 **/ Node() string /** * 创建唯一ID **/ NewID() int64 /** * 区域ID **/ Aid() int64 /** * 节点ID **/ Nid() int64 /** * 新建上下文 **/ NewContext(path string, trace string) Context /** * 获取服务 **/ GetService(name string) (Service, error) /** * 获取服务运行器 **/ GetExecutor(name string) (Executor, error) /** * 退出 **/ Exit() /** * 退出, 退出后 C <- 1 **/ ExitWait(C chan int8) GetValue(key string) interface{} SetValue(key string, value interface{}) }
*
- 运行时 *
type Scheme ¶ added in v1.0.19
type Scheme struct { Name string `json:"name"` Items []*SchemeItem `json:"items"` Objects map[string]*SchemeObject `json:"objects"` }
type SchemeField ¶ added in v1.0.19
type SchemeItem ¶ added in v1.0.19
type SchemeItem struct { Name string `json:"name"` Task *SchemeObject `json:"task"` Result *SchemeObject `json:"result"` }
type SchemeObject ¶ added in v1.0.19
type SchemeObject struct {
Fields []*SchemeField `json:"fields"`
}
type Service ¶
type Service interface { Recycle /** * 服务名称 **/ Name() string /** * 服务配置 **/ Config() interface{} /** * 初始化服务 **/ OnInit(ctx Context) error /** * 校验服务是否可用 **/ OnValid(ctx Context) error }
*
- 服务 *
type ServiceFactory ¶
Click to show internal directories.
Click to hide internal directories.