You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am exploring if bloblang could be used inside gitea for webhook payload transformation (go-gitea/gitea#19307 (comment))
I have a working prototype, however it is quite hacky since it seems that bloblang.Executor.Query only works properly with an argument of type map[string]interface{} and not with arbitrary struct.
Currently to get an object inside bloblang, I json-marshal my struct and unmarshal it in a map[string]interface{} object...
Is there any cleaner way to get a proper object inside bloblang without marshalling+unmarshalling?
The text was updated successfully, but these errors were encountered:
Hey @oliverpool, the bloblang engine doesn't support reflection of struct types when expanding fields so any data that you want mappings to be able to traverse needs to be in maps and empty interface slices.
Adding reflection is something I'd possibly be open to but for now it might be cleaner to use https://github.com/mitchellh/mapstructure as that'd save you the performance hit of byte serialization back and forth.
Thank your for the quick reply!
I don't think that https://github.com/mitchellh/mapstructure works in my case, since I already have a struct, which I need to transform to a map[string]interface to use bloblang (and not the other way around).
I can use mapstructure on the result if I want to reconstruct a nice structure.
I proposed a fix in the gabs package: Jeffail/gabs#122 let me know what you think
Hi,
I am exploring if
bloblang
could be used inside gitea for webhook payload transformation (go-gitea/gitea#19307 (comment))I have a working prototype, however it is quite hacky since it seems that
bloblang.Executor.Query
only works properly with an argument of typemap[string]interface{}
and not with arbitrary struct.Code example:
Output:
Currently to get an object inside bloblang, I json-marshal my struct and unmarshal it in a
map[string]interface{}
object...Is there any cleaner way to get a proper object inside
bloblang
without marshalling+unmarshalling?The text was updated successfully, but these errors were encountered: