Introducing Turbine transforms (flatten)
This is a legacy platform changelog. The information reflected here may not represent current functionality and some links may be broken.
As a team solely focused on developer tools, we're always looking for ways to improve the developer experience, increase productivity and reduce friction.
With that in mind, the Turbine Go library recently introduced built-in transforms to bake in commonly use transform functionality.
As of this post, the transforms
package includes two transforms, flatten
and unwrap
.
Flatten
The flatten
transform takes a nested JSON payload and flattens it so that it is only one level deep. Here's an example of it in action:
{
"id": 1,
"user": {
"id": 100,
"name": "alice",
"email": "[email protected]"
},
"actions": ["register", "purchase"]
}
{
"actions.0": "register",
"actions.1": "purchase",
"id": 1,
"user.email": "[email protected]",
"user.id": 100,
"user.name": "alice"
}
This is useful for when you're going from a data store that supports nested objects (say a NoSQL Document Store like MongoDB) to a relational database (like Postgres or Amazon Redshift).
We will continue to expand the number of built-in transforms as well as extend them to support additional configuration and expand their usefulness.
You can see a full example of a Turbine App using the flatten transform here: Flatten Example Turbine App
As always, we'd love to receive feedback and suggestions on how we can improve.
For any questions or comments, please feel free to email us at [email protected] or reach out to us on Twitter or on Discord.