Replaced cache with opts in several structs

This commit is contained in:
andronache
2021-03-16 10:46:03 +02:00
committed by Dan Christian Bogos
parent 83d9c67a77
commit 22f207441e
27 changed files with 116 additions and 147 deletions

View File

@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package console
import (
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/utils"
)
@@ -27,7 +26,7 @@ func init() {
c := &CmdSetAccountProfile{
name: "accounts_profile_set",
rpcMethod: utils.APIerSv1SetAccountProfile,
rpcParams: &v1.APIAccountProfileWithCache{},
rpcParams: &utils.APIAccountProfileWithOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -36,7 +35,7 @@ func init() {
type CmdSetAccountProfile struct {
name string
rpcMethod string
rpcParams *v1.APIAccountProfileWithCache
rpcParams *utils.APIAccountProfileWithOpts
*CommandExecuter
}
@@ -50,7 +49,7 @@ func (self *CmdSetAccountProfile) RpcMethod() string {
func (self *CmdSetAccountProfile) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v1.APIAccountProfileWithCache{APIAccountProfile: new(utils.APIAccountProfile)}
self.rpcParams = &utils.APIAccountProfileWithOpts{APIAccountProfile: new(utils.APIAccountProfile)}
}
return self.rpcParams
}

View File

@@ -28,7 +28,7 @@ func init() {
c := &CmdSetAttributes{
name: "attributes_profile_set",
rpcMethod: utils.APIerSv2SetAttributeProfile,
rpcParams: &v2.AttributeWithCache{},
rpcParams: &v2.AttributeWithOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdSetAttributes struct {
name string
rpcMethod string
rpcParams *v2.AttributeWithCache
rpcParams *v2.AttributeWithOpts
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdSetAttributes) RpcMethod() string {
func (self *CmdSetAttributes) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &v2.AttributeWithCache{APIAttributeProfile: new(engine.APIAttributeProfile)}
self.rpcParams = &v2.AttributeWithOpts{APIAttributeProfile: new(engine.APIAttributeProfile)}
}
return self.rpcParams
}

View File

@@ -27,7 +27,7 @@ func init() {
c := &CmdSetStatQueue{
name: "stats_profile_set",
rpcMethod: utils.APIerSv1SetStatQueueProfile,
rpcParams: &engine.StatQueueWithCache{},
rpcParams: &engine.StatQueueProfileWithOpts{},
}
commands[c.Name()] = c
c.CommandExecuter = &CommandExecuter{c}
@@ -37,7 +37,7 @@ func init() {
type CmdSetStatQueue struct {
name string
rpcMethod string
rpcParams *engine.StatQueueWithCache
rpcParams *engine.StatQueueProfileWithOpts
*CommandExecuter
}
@@ -51,7 +51,7 @@ func (self *CmdSetStatQueue) RpcMethod() string {
func (self *CmdSetStatQueue) RpcParams(reset bool) interface{} {
if reset || self.rpcParams == nil {
self.rpcParams = &engine.StatQueueWithCache{
self.rpcParams = &engine.StatQueueProfileWithOpts{
StatQueueProfile: new(engine.StatQueueProfile),
Opts: make(map[string]interface{}),
}