Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
Handle casting of native Array and Map values [nt]
Browse files Browse the repository at this point in the history
  • Loading branch information
flarco committed Jan 17, 2024
1 parent 0e8d1db commit f615d02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion iop/datatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func (cols Columns) Types(args ...bool) []string {
field = CleanName(field) // clean up
}

fields[j] = g.F("%s [%s]", field, column.Type)
fields[j] = g.F("%s [%s | %s]", field, column.Type, column.DbType)
}
return fields
}
Expand Down
6 changes: 5 additions & 1 deletion iop/stream_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ func (sp *StreamProcessor) CastVal(i int, val interface{}, col *Column) interfac
switch {
case col.Type.IsString():
if sVal == "" && val != nil {
sVal = cast.ToString(val)
if reflect.TypeOf(val).Kind() == reflect.Slice || reflect.TypeOf(val).Kind() == reflect.Map {
sVal = g.Marshal(val)
} else {
sVal = cast.ToString(val)
}
}

// apply transforms
Expand Down

0 comments on commit f615d02

Please sign in to comment.