Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support arrays #7

Merged
merged 11 commits into from Jun 21, 2021
Merged

Support arrays #7

merged 11 commits into from Jun 21, 2021

Conversation

gilsegment
Copy link
Contributor

@gilsegment gilsegment commented Jun 17, 2021

Description

This PR adds the option to support arrays while flattening map.
This was originally raised by failure reported in this ticket: https://segment.atlassian.net/browse/SRC-2564
The change is backward compatible. Only if explicitly setting StringifyArr=true, then array will be stringified

Testing

Added relevant unit tests

Deployment

Merge to master

Rollback procedure

Revert this PR from master

tableize.go Outdated
@@ -13,6 +15,7 @@ type Input struct {
// Optional
HintSize int
Substitutions map[string]string
StringifyArr bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird to shorten "Array" to "Arr", but not "Stringify". Can we change this to StringifyArrays bool?

tableize.go Outdated
if stringifyArr {
valByteArr, err := json.Marshal(val)
if err != nil {
log.Printf("[Error] Unable to marshall value `%v` err: %v", val, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this log line to something like:

log.Printf("go-tableize: dropping array value %+v that could not be converted to string: %s\n", val, err)

@gilsegment gilsegment changed the title Support arr Support arrays Jun 18, 2021
@gilsegment gilsegment removed the request for review from ynguyensegment June 21, 2021 12:39
@gilsegment gilsegment merged commit 2255500 into master Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants