Documentation ¶
Overview ¶
Package spiderman 为集成 Pizza, Sso, Schedule, Alert, Msg, Gohr, Comment等服务的客户端
Index ¶
- type Spiderman
- type SpidermanClient
- func (receiver *SpidermanClient) Alert(conf dto.AlertConf) (alert.AlertInterface, error)
- func (receiver *SpidermanClient) GoHr(conf dto.GoHrConf) (gohr.GoHrInterface, error)
- func (receiver *SpidermanClient) Pizza(conf dto.PizzaConf) (pizza.PizzaInterface, error)
- func (receiver *SpidermanClient) Schedule(conf dto.ScheduleConf) (schedule.ScheduleInterface, error)
- func (receiver *SpidermanClient) Sso(conf dto.SsoConf) (sso.SsoInterface, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spiderman ¶
type Spiderman interface { Alert(conf dto.AlertConf) (alert.AlertInterface, error) //Alert 消息服务 Pizza(conf dto.PizzaConf) (pizza.PizzaInterface, error) //Pizza pizza服务 Schedule(conf dto.ScheduleConf) (schedule.ScheduleInterface, error) //Schedule 定时任务调度服务 Sso(conf dto.SsoConf) (sso.SsoInterface, error) //Sso sso服务 GoHr(conf dto.GoHrConf) (gohr.GoHrInterface, error) //GoHr gohr服务 }
Spiderman support pipelining using the Pizza, Sso, Schedule and Alert methods
type SpidermanClient ¶
func (*SpidermanClient) Alert ¶
func (receiver *SpidermanClient) Alert(conf dto.AlertConf) (alert.AlertInterface, error)
Alert store alert service
Example ¶
conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := NewSpiderman(conf) alertConf := dto.AlertConf{ BaseUri: "127.0.0.1", Level: "warn", Env: "test", } alert, _ := spiderman.Alert(alertConf) fmt.Println(alert)
Output:
func (*SpidermanClient) GoHr ¶ added in v0.1.2
func (receiver *SpidermanClient) GoHr(conf dto.GoHrConf) (gohr.GoHrInterface, error)
GoHr store GoHr service
func (*SpidermanClient) Pizza ¶
func (receiver *SpidermanClient) Pizza(conf dto.PizzaConf) (pizza.PizzaInterface, error)
Pizza store pizza service
Example ¶
conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := NewSpiderman(conf) pizzaConf := dto.PizzaConf{ BaseUri: "127.0.0.1", } pizza, _ := spiderman.Pizza(pizzaConf) fmt.Println(pizza)
Output:
func (*SpidermanClient) Schedule ¶
func (receiver *SpidermanClient) Schedule(conf dto.ScheduleConf) (schedule.ScheduleInterface, error)
Schedule store schedule service
Example ¶
conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := NewSpiderman(conf) schedule, _ := spiderman.Schedule(dto.ScheduleConf{ BaseUri: "http://127.0.0.1:8081", CallbackUri: "http://127.0.0.1:8080", }) fmt.Println(schedule)
Output:
func (*SpidermanClient) Sso ¶
func (receiver *SpidermanClient) Sso(conf dto.SsoConf) (sso.SsoInterface, error)
Sso store sso service
Example ¶
conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := NewSpiderman(conf) ssoConf := dto.SsoConf{ BaseUri: "127.0.0.1", AppId: "test", AppKey: "test1", } sso, _ := spiderman.Sso(ssoConf) fmt.Println(sso)
Output:
Directories ¶
Path | Synopsis |
---|---|
core
|
|
schedule
使用 RegisterCorn 和 RegisterCornTime 之前必须先使用 RegisterHandler 注册路由 使用 RegisterCorn 和 RegisterCornTime 里有判断是否已经使用 RegisterHandler 注册路由的强制校验 保证调用 RegisterHandler 和调用 RegisterCorn 或 RegisterCornTime 的 Schedule 为同一个实例化,否则报错 conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := spiderman2.NewSpiderman(conf) schedule,_ := spiderman.Schedule(dto.ScheduleConf{ BaseUri: "http://127.0.0.1:8081", CallbackUri: "http://127.0.0.1:8080", }) var r *gin.Engine _ = schedule.RegisterHandler(r, JobHandelFunc, "/test/path") _= schedule.RegisterCorn(dto.ScheduleRegisterInput{ ScheduleId: "test-talent", ScheduleName: "ttttt", CallbackParams: nil, Value: "*\/1 * * * *", })
|
使用 RegisterCorn 和 RegisterCornTime 之前必须先使用 RegisterHandler 注册路由 使用 RegisterCorn 和 RegisterCornTime 里有判断是否已经使用 RegisterHandler 注册路由的强制校验 保证调用 RegisterHandler 和调用 RegisterCorn 或 RegisterCornTime 的 Schedule 为同一个实例化,否则报错 conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := spiderman2.NewSpiderman(conf) schedule,_ := spiderman.Schedule(dto.ScheduleConf{ BaseUri: "http://127.0.0.1:8081", CallbackUri: "http://127.0.0.1:8080", }) var r *gin.Engine _ = schedule.RegisterHandler(r, JobHandelFunc, "/test/path") _= schedule.RegisterCorn(dto.ScheduleRegisterInput{ ScheduleId: "test-talent", ScheduleName: "ttttt", CallbackParams: nil, Value: "*\/1 * * * *", }) |
pkg
|
|
Click to show internal directories.
Click to hide internal directories.