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

Nested structures #69

Open
MilosSimic opened this issue Jan 11, 2022 · 0 comments
Open

Nested structures #69

MilosSimic opened this issue Jan 11, 2022 · 0 comments

Comments

@MilosSimic
Copy link

I'm curious how to store and restore nested structures, for example slice/array of structs, or map where key is string and value is some other struct (arbitrarily nested). What would be the best strategy for this?

I was able to store and restore JSON as is, but what If I have some already mapped structs, is it possible to reuse them somehow?
For example:

type TB struct {
B string
DataTB map[string]string
}

type A struct {
A string
DataTA map[string]string
B TB
DataTC map[string]TC
}

At the moment, all thins except DataTC which is map[string]TC, will be stored and restored properly. Only DataTC will end up as an empty map. What is the best solution for this?

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

No branches or pull requests

1 participant