Add KV Maps method to load data from the KV #46
Add KV Maps method to load data from the KV #46
Conversation
Yeah, I would totally see this I'm not quite sure why you're having cyclical imports, what packages are making the cycle? Isn't everything inside the Other than this, though, it looks really good! 👍🏼 |
When I want to create UT for this new |
break import cycle loop with a concrete function field
@stefanotorresi Thanks for your help. PR ready to be reviewed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks brilliant, Xabi!
Could you please update the consul import names as I mentioned in #45 (review)?
Done! |
9b473ac
to
dd03efd
Compare
"Maps" is a bit hard to read for me (I read it as Google Maps not as Mappings). maybe call it "MakeMap" ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maps is not very intuitive as a name for me, otherwise it looks good to me.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, Xabi!
Implementation of the
Maps
method to load the KV storage value to a map. It is a generic method to load the information and use it easily. Some kind of marshalling. I creates a map because it is the most flexible way. One of the next steps would be to do the opposite way, store the data in the KV starting on a map.This works out of the box. It doesn't matter if the all the elements in the path are created individually or in 1 shot.
I have thought to include this as consul Client method, but mockery mocks it and it makes the test different, but we can obviously do it.
This is the are key list example:
Or
Both return the same map:
This is still a working progress (the UT is a big of a nightmare, as I would need to move the
kvstore.go
file out ofinternal/consul
to avoid cyclical imports.Opinions?