Documentation
¶
Index ¶
- Constants
- Variables
- func CliCall(ctx Ctx, service, path string, req, rsp proto.Message) error
- func CmdExecute(ctx Ctx, cfg Cfg, executors []Executor, rpcs []RpcDoc) error
- func Env(key string) string
- func Envs() map[string]string
- func Init(project, service string, isCmd bool)
- func LoadEnv(prefix string)
- func SetDefApp(app *App)
- func SvrRun(ctx Ctx, cfg Cfg, handlers []Handler, rpcs []RpcDoc) error
- func TestCall(rpcFn interface{}, ctx Ctx, req proto.Message, init ...func()) (proto.Message, error)
- func TestCallByJson(rpcFn interface{}, ctx Ctx, jsonStr string, init ...func()) (proto.Message, error)
- func TestGetReq(req proto.Message, str string, init ...func()) proto.Message
- type Addr
- type Addrs
- type App
- type Cfg
- type Cli
- type Cmd
- type CmdCtx
- type Ctx
- type ExecHandler
- type Executor
- type Handler
- type Rpc
- type RpcCtx
- type RpcDoc
- type Svr
- type TestCase
- type TestCaseInput
Constants ¶
View Source
const ( EnvModule = "MODULE" EnvWorkPath = "WORK_PATH" EnvProtoc = "PROTOC" EnvProtoPath = "PROTO_PATH" EnvTplPath = "TPL_PATH" )
View Source
const ( HeaderErrCode = "X-ErrCode" HeaderErrMsg = "X-ErrMsg" )
Variables ¶
View Source
var ErrConfigNotFound = errorx.New("config not found")
Functions ¶
func TestCallByJson ¶
Types ¶
type Cfg ¶
type Cfg struct {
Name string
Addr string
Path string
AddrsFile string
// contains filtered or unexported fields
}
func (*Cfg) GetJsonData ¶
type Cmd ¶
type Cmd struct {
*Cfg
// contains filtered or unexported fields
}
func (*Cmd) RegisterExecutors ¶
type CmdCtx ¶
type CmdCtx struct {
// contains filtered or unexported fields
}
func (*CmdCtx) GetInstant ¶
func (ctx *CmdCtx) GetInstant() interface{}
type Executor ¶
type Executor struct {
Path string
ExecHandler ExecHandler
}
type Handler ¶
type Handler struct {
Path string
Handle interface{}
// contains filtered or unexported fields
}
type RpcCtx ¶
type RpcCtx struct {
// contains filtered or unexported fields
}
func (*RpcCtx) GetInstant ¶
func (ctx *RpcCtx) GetInstant() interface{}
type Svr ¶
func (*Svr) RegisterHandlers ¶
type TestCase ¶
type TestCase struct {
Description string
Input TestCaseInput
Error bool
Result interface{}
}
Click to show internal directories.
Click to hide internal directories.