1 Star 0 Fork 0

liwen_test_sync_group/endly

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
api.go 2.14 KB
一键复制 编辑 原始数据 按行查看 历史
package endly
import (
"github.com/viant/toolbox"
"github.com/viant/toolbox/data"
"sync"
)
// AppName represents endly application name
const AppName = "endly"
// Namespace represents endly namespace
const Namespace = "github.com/viant/endly/"
// Manager represents a endly service manager
type Manager interface {
//Name returns an application SessionID
Name() string
//Version returns an application version
Version() string
//Service return a workflow service for provided SessionID, request, or error
Service(input interface{}) (Service, error)
//Register register service in this manager
Register(service Service)
//NewContext returns new workflow context.
NewContext(context toolbox.Context) *Context
//Run run requests
Run(context *Context, request interface{}) (interface{}, error)
}
// Service represents an endly service
type Service interface {
//service id
ID() string
//service state map
State() data.Map
//Run service action for supported request types.
Run(context *Context, request interface{}) *ServiceResponse
//Route returns service action route
Route(action string) (*Route, error)
Mutex() *sync.RWMutex
Actions() []string
}
// Validator represents generic validator
type Validator interface {
Validate() error
}
// Initializer represents generic initializer
type Initializer interface {
Init() error
}
// ServiceResponse service response
type ServiceResponse struct {
Status string
Error string
Response interface{}
Err error
}
// Route represents service action route
type Route struct {
Action string
RequestInfo *ActionInfo
ResponseInfo *ActionInfo
RequestProvider func() interface{}
ResponseProvider func() interface{}
Handler func(context *Context, request interface{}) (interface{}, error)
OnRawRequest func(context *Context, rawRequest map[string]interface{}) error //when specified it is called each time action literal is used when match
}
// Description represents example use case
type UseCase struct {
Description string
Data string
}
// ActionInfo represent an action info
type ActionInfo struct {
Description string
Examples []*UseCase
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liwen_test_sync_group/endly.git
git@gitee.com:liwen_test_sync_group/endly.git
liwen_test_sync_group
endly
endly
master

搜索帮助