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 custom structs #14

Open
xrstf opened this issue Dec 31, 2023 · 1 comment
Open

Support custom structs #14

xrstf opened this issue Dec 31, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@xrstf
Copy link
Owner

xrstf commented Dec 31, 2023

Currently Rudi works only/best with pure map[string]any, generic datastructures. However it would be nice if one could also just use any kind of Go struct, similar to how Go templates also allow to access fields in structs using reflection.

Structs can of course contain pointer fields and those must be taken care of separately, as most funtions in Rudi do not take pointers (like concat), but Rudi also offers no language elements to dereference a pointer, nor do I intend to add such language elements. My plan is to automatically dereference pointers when evaluating a JSON path, so that if a field is nil, nil is returned, otherwise the dereferenced value.

In general, pointers are discouraged in Rudi and can lead to many hard to troubleshoot side effects. Support for them is on a best effort basis.

@xrstf xrstf added the enhancement New feature or request label Dec 31, 2023
@xrstf
Copy link
Owner Author

xrstf commented Mar 9, 2024

Work on this is slowly progressing in the jsonpath2, jsonpath3 and multipath branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant