mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated versions
This commit is contained in:
18
utils/map.go
18
utils/map.go
@@ -17,7 +17,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"strings"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Converts map[string]string into map[string]interface{}
|
||||
func ConvertMapValStrIf(inMap map[string]string) map[string]interface{} {
|
||||
@@ -190,7 +193,6 @@ func MapKeysReplace(m map[string]struct{}, old, new string) map[string]struct{}
|
||||
return m
|
||||
}
|
||||
*/
|
||||
|
||||
// Used to merge multiple maps (eg: output of struct having ExtraFields)
|
||||
func MergeMapsStringIface(mps ...map[string]interface{}) (outMp map[string]interface{}) {
|
||||
outMp = make(map[string]interface{})
|
||||
@@ -217,3 +219,15 @@ func (fmp FieldMultiplyFactor) Clone() (cln FieldMultiplyFactor) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func MapStringToInt64(in map[string]string) (out map[string]int64, err error){
|
||||
mapout := make(map[string]int64, len(in))
|
||||
for key, val := range in {
|
||||
x,err:=strconv.Atoi(val)
|
||||
if err!=nil{
|
||||
return nil,err
|
||||
}
|
||||
mapout[key] = int64(x)
|
||||
}
|
||||
return mapout,nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user