本文整理匯總了Golang中github.com/cgrates/cgrates/utils.TPAccountActions.Direction方法的典型用法代碼示例。如果您正苦於以下問題:Golang TPAccountActions.Direction方法的具體用法?Golang TPAccountActions.Direction怎麽用?Golang TPAccountActions.Direction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cgrates/cgrates/utils.TPAccountActions
的用法示例。
在下文中一共展示了TPAccountActions.Direction方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: LoadAccountActions
// Process dependencies and load a specific AccountActions profile from storDb into dataDb.
func (self *ApierV1) LoadAccountActions(attrs utils.TPAccountActions, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "LoadId", "Tenant", "Account", "Direction"}); len(missing) != 0 {
return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing)
}
dbReader := engine.NewDbReader(self.StorDb, self.RatingDb, self.AccountDb, attrs.TPid)
if attrs.LoadId == utils.EMPTY {
attrs.LoadId = ""
}
if attrs.Tenant == utils.EMPTY {
attrs.Tenant = ""
}
if attrs.Account == utils.EMPTY {
attrs.Account = ""
}
if attrs.Direction == utils.EMPTY {
attrs.Direction = ""
}
if _, err := engine.AccLock.Guard(attrs.KeyId(), func() (float64, error) {
if err := dbReader.LoadAccountActionsFiltered(&attrs); err != nil {
return 0, err
}
return 0, nil
}); err != nil {
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
}
// ToDo: Get the action keys loaded by dbReader so we reload only these in cache
// Need to do it before scheduler otherwise actions to run will be unknown
if err := self.AccountDb.CacheAccounting(nil, nil, nil, []string{}); err != nil {
return err
}
if self.Sched != nil {
self.Sched.LoadActionTimings(self.AccountDb)
self.Sched.Restart()
}
*reply = OK
return nil
}