Renamed console files and tested functions from utils/struct.go

This commit is contained in:
Anevo
2018-03-26 11:22:49 -04:00
committed by Dan Christian Bogos
parent 55bdff293d
commit a2ca4ef7e3
7 changed files with 68 additions and 313 deletions

View File

@@ -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 {