本文整理汇总了Golang中github.com/kihamo/shadow.Application类的典型用法代码示例。如果您正苦于以下问题:Golang Application类的具体用法?Golang Application怎么用?Golang Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Init
func (r *SenderResource) Init(a *shadow.Application) error {
resourceConfig, err := a.GetResource("config")
if err != nil {
return err
}
r.config = resourceConfig.(*resource.Config)
return nil
}
开发者ID:kihamo,项目名称:shadow-sender,代码行数:9,代码来源:sender.go
示例2: Init
func (r *DaoResource) Init(a *shadow.Application) error {
resourceDatabase, err := a.GetResource("database")
if err != nil {
return err
}
r.database = resourceDatabase.(*database.Database)
return nil
}
开发者ID:kihamo,项目名称:shadow-sender,代码行数:9,代码来源:resource.go
示例3: Init
func (r *Resource) Init(a *shadow.Application) error {
resourceConfig, err := a.GetResource("config")
if err != nil {
return err
}
r.config = resourceConfig.(*config.Resource)
r.application = a
return nil
}
开发者ID:kihamo,项目名称:shadow-sms,代码行数:11,代码来源:resource.go
示例4: Init
func (s *ApiService) Init(a *shadow.Application) error {
s.application = a
resourceConfig, err := a.GetResource("config")
if err != nil {
return err
}
s.config = resourceConfig.(*config.Resource)
return nil
}
开发者ID:kihamo,项目名称:shadow-api,代码行数:11,代码来源:service.go
示例5: Init
func (s *SmsService) Init(a *shadow.Application) error {
s.application = a
resourceSmsIntel, err := a.GetResource("smsintel")
if err != nil {
return err
}
s.sms = resourceSmsIntel.(*smsintel.Resource)
return nil
}
开发者ID:kihamo,项目名称:shadow-sms,代码行数:11,代码来源:service.go
示例6: Init
func (p *AbstractApiProcedure) Init(s shadow.Service, a *shadow.Application) error {
p.Application = a
p.Service = s
if apiService, err := a.GetService("api"); err == nil {
if castService, ok := apiService.(*ApiService); ok {
p.ApiService = castService
return nil
}
}
return errors.New("Api service not found")
}
开发者ID:kihamo,项目名称:shadow-api,代码行数:13,代码来源:procedure.go
示例7: Init
func (r *Resource) Init(a *shadow.Application) error {
r.application = a
r.services = map[string]interface{}{}
resourceConfig, err := a.GetResource("config")
if err != nil {
return err
}
r.config = resourceConfig.(*config.Resource)
return nil
}
开发者ID:kihamo,项目名称:shadow-aws,代码行数:13,代码来源:resource.go
示例8: Init
func (s *SenderService) Init(a *shadow.Application) error {
s.application = a
resourceSender, err := a.GetResource("sender")
if err != nil {
return err
}
s.Sender = resourceSender.(*resource.SenderResource)
resourceConfig, err := a.GetResource("config")
if err != nil {
return err
}
s.config = resourceConfig.(*r.Config)
serviceFrontend, err := a.GetService("frontend")
if err != nil {
return err
}
s.FrontendService = serviceFrontend.(*frontend.FrontendService)
resourceLogger, err := a.GetResource("logger")
if err != nil {
return err
}
s.Logger = resourceLogger.(*r.Logger).Get(s.GetName())
resourceStorage, err := a.GetResource("database")
if err != nil {
return err
}
s.storage = resourceStorage.(*database.Database).GetStorage()
s.storage.AddTableWithName(model.Application{}, model.TableApplications).ColMap("token").SetUnique(true)
s.storage.AddTableWithName(model.Endpoint{}, model.TableEndpoints).ColMap("token").SetUnique(true)
s.storage.AddTableWithName(model.Message{}, model.TableMessages)
s.storage.AddTableWithName(model.Publish{}, model.TablePublishes)
if err = s.storage.CreateTablesIfNotExists(); err != nil {
return err
}
// provides
s.Balances = map[string]float64{}
if s.Sender.HasProvider("smsintel") {
s.Balances["smsintel"] = float64(0)
}
return nil
}
开发者ID:kihamo,项目名称:shadow-sender,代码行数:51,代码来源:service.go
示例9: Init
func (c *AbstractSlackCommand) Init(s shadow.Service, a *shadow.Application) {
c.Application = a
c.Service = s
slackService, err := a.GetService("slack")
if err == nil {
if castService, ok := slackService.(*SlackService); ok {
c.SlackService = castService
return
}
}
panic("Slack service not found")
}
开发者ID:kihamo,项目名称:shadow-slack,代码行数:14,代码来源:command.go
示例10: Init
func (p *AbstractSenderApiProcedure) Init(s shadow.Service, a *shadow.Application) {
p.AbstractApiProcedure.Init(s, a)
resourceConfig, _ := a.GetResource("config")
p.Config = resourceConfig.(*r.Config)
resourceLogger, _ := a.GetResource("logger")
p.Logger = resourceLogger.(*r.Logger).Get("sender")
resourceTasks, _ := a.GetResource("tasks")
p.Tasks = resourceTasks.(*r.Dispatcher)
resourceDao, _ := a.GetResource("sender.dao")
p.Dao = resourceDao.(*dao.DaoResource)
resourceSender, _ := a.GetResource("sender")
p.Sender = resourceSender.(*resource.SenderResource)
}
开发者ID:kihamo,项目名称:shadow-sender,代码行数:18,代码来源:api.go
示例11: Init
func (s *SlackService) Init(a *shadow.Application) error {
s.application = a
resourceConfig, err := a.GetResource("config")
if err != nil {
return err
}
s.config = resourceConfig.(*resource.Config)
resourceLogger, err := a.GetResource("logger")
if err != nil {
return err
}
s.logger = resourceLogger.(*resource.Logger).Get(s.GetName())
s.Commands = map[string]SlackCommand{}
return nil
}
开发者ID:kihamo,项目名称:shadow-slack,代码行数:19,代码来源:service.go
注:本文中的github.com/kihamo/shadow.Application类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论