This commit is contained in:
Ramiro Paz
2026-05-11 12:34:55 -03:00
parent 45fad9de6c
commit 99c7f8ccb0
8 changed files with 69 additions and 49 deletions

View File

@ -25,6 +25,7 @@ func GetMap(fieldMap FieldMap) map[string]interface{} {
result := map[string]interface{}{}
for f, v := range fieldMap {
slog.Info("try to parse fieldMap: %+v, value: %+v", f, v)
k, val := GetKeyValue(f, v)
result[k] = val
}
@ -42,7 +43,7 @@ func GetKeyValue(f FixField, value FieldValue) (key string, val interface{}) {
fMapLst, ok := value.([]FieldMap)
if !ok {
err := tracerr.Errorf("could not parse as []FieldMap, value: %+v", value)
err := tracerr.Errorf("could not parse as []FieldMap, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}
@ -54,23 +55,15 @@ func GetKeyValue(f FixField, value FieldValue) (key string, val interface{}) {
case "BOOLEAN":
b, ok := value.(bool)
if !ok {
err := tracerr.Errorf("could not parse as bool, value: %+v", value)
err := tracerr.Errorf("could not parse as bool, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}
val = b
case "INT":
case "INT", "LENGTH", "SEQNUM":
i, ok := value.(int)
if !ok {
err := tracerr.Errorf("could not parse as int, value: %+v", value)
slog.Error(err.Error())
}
val = i
case "SEQNUM":
i, ok := value.(int)
if !ok {
err := tracerr.Errorf("could not parse as int, value: %+v", value)
err := tracerr.Errorf("could not parse as int, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}
@ -78,7 +71,7 @@ func GetKeyValue(f FixField, value FieldValue) (key string, val interface{}) {
case "UTCTIMESTAMP":
t, ok := value.(time.Time)
if !ok {
err := tracerr.Errorf("could not parse as Time, value: %+v", value)
err := tracerr.Errorf("could not parse as Time, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}
@ -86,7 +79,7 @@ func GetKeyValue(f FixField, value FieldValue) (key string, val interface{}) {
case "STRING":
s, ok := value.(string)
if !ok {
err := tracerr.Errorf("could not parse as string, value: %+v", value)
err := tracerr.Errorf("could not parse as string, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}
@ -94,7 +87,7 @@ func GetKeyValue(f FixField, value FieldValue) (key string, val interface{}) {
case "CHAR":
s, ok := value.(string)
if !ok {
err := tracerr.Errorf("could not parse as string, value: %+v", value)
err := tracerr.Errorf("could not parse as string, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}
@ -102,7 +95,7 @@ func GetKeyValue(f FixField, value FieldValue) (key string, val interface{}) {
default:
s, ok := value.(string)
if !ok {
err := tracerr.Errorf("could not parse as string, value: %+v", value)
err := tracerr.Errorf("could not parse as string, value: %+v, key: %s", value, key)
slog.Error(err.Error())
}