From ac483dd76031b38169613fd34da4605fb5c691f7 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Tue, 9 Aug 2022 11:50:27 +0300 Subject: [PATCH] Add RPCClone func on CGREventWithEeIDs obj to implement RPCCloner interface --- engine/argees.go | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/engine/argees.go b/engine/argees.go index c759e9671..c38e31a65 100644 --- a/engine/argees.go +++ b/engine/argees.go @@ -26,10 +26,31 @@ import ( // CGREventWithEeIDs struct is moved in engine due to importing ciclying packages in order to unmarshalling properly for our EventCost type. This is the API struct argument -// CGREventWithEeIDs is the CGREventWithOpts with EventExporterIDs +// CGREventWithEeIDs is CGREvent with EventExporterIDs type CGREventWithEeIDs struct { EeIDs []string *utils.CGREvent + clnb bool +} + +func (attr *CGREventWithEeIDs) Clone() *CGREventWithEeIDs { + return &CGREventWithEeIDs{ + EeIDs: utils.CloneStringSlice(attr.EeIDs), + CGREvent: attr.CGREvent.Clone(), + } +} + +// SetCloneable sets if the args should be cloned on internal connections +func (attr *CGREventWithEeIDs) SetCloneable(clnb bool) { + attr.clnb = clnb +} + +// RPCClone implements rpcclient.RPCCloner interface +func (attr *CGREventWithEeIDs) RPCClone() (interface{}, error) { + if !attr.clnb { + return attr, nil + } + return attr.Clone(), nil } func (cgr *CGREventWithEeIDs) UnmarshalJSON(data []byte) (err error) {