mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Renamed console files and tested functions from utils/struct.go
This commit is contained in:
committed by
Dan Christian Bogos
parent
55bdff293d
commit
a2ca4ef7e3
@@ -86,7 +86,7 @@ func NonemptyStructFields(s interface{}) map[string]interface{} {
|
||||
}*/
|
||||
|
||||
// Converts a struct to map[string]interface{}
|
||||
func ToMapMapStringInterface(in interface{}) map[string]interface{} {
|
||||
func ToMapMapStringInterface(in interface{}) map[string]interface{} { // Got error and it is not used anywhere
|
||||
out := make(map[string]interface{})
|
||||
|
||||
v := reflect.ValueOf(in)
|
||||
@@ -224,7 +224,7 @@ func FromMapStringInterfaceValue(m map[string]interface{}, v reflect.Value) (int
|
||||
}
|
||||
|
||||
// Update struct with map fields, returns not matching map keys, s is a struct to be updated
|
||||
func UpdateStructWithStrMap(s interface{}, m map[string]string) []string {
|
||||
func UpdateStructWithStrMap(s interface{}, m map[string]string) []string { // Not tested and declared and used only here
|
||||
notMatched := []string{}
|
||||
for key, val := range m {
|
||||
fld := reflect.ValueOf(s).Elem().FieldByName(key)
|
||||
@@ -253,7 +253,7 @@ func UpdateStructWithStrMap(s interface{}, m map[string]string) []string {
|
||||
}
|
||||
|
||||
// UpdateStructWithIfaceMap will update struct fields with values coming from map
|
||||
// if map values are not matching the ones in strcut convertion is being attempted
|
||||
// if map values are not matching the ones in struct convertion is being attempted
|
||||
// ToDo: add here more fields
|
||||
func UpdateStructWithIfaceMap(s interface{}, mp map[string]interface{}) (err error) {
|
||||
for key, val := range mp {
|
||||
|
||||
Reference in New Issue
Block a user