Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Implement the repo.Latest method of the new charm store. #94
Conversation
mhilton
reviewed
Mar 18, 2015
| + urls[i] = url | ||
| + ids[i] = "id=" + url | ||
| + } | ||
| + path := "/meta/any?include=id-revision&include=hash256&" + strings.Join(ids, "&") |
mhilton
Mar 18, 2015
Member
Perhaps you could build this with a URL e.g.
var u url.URL
u.Path = "/meta/any"
var v url.Values
v.Add("include", "id-revision")
v.Add("include", "hash256")
for i, curl := range curls {
url := curl.WithRevision(-1).String()
urls[i] = url
v.Add("id", url)
}
u.RawQuery = v.Encode()
path = u.String()
?
|
|
rogpeppe
reviewed
Mar 18, 2015
| + path := "/meta/any?include=id-revision&include=hash256&" + strings.Join(ids, "&") | ||
| + | ||
| + // Execute the request and retrieve results. | ||
| + var results map[string]struct { |
rogpeppe
Mar 18, 2015
Owner
I think you could avoid some work here by declaring
the retrieved fields explicitly:
var results map[string] struct {
Meta struct {
IdRevision params.IdRevisionResponse `json:"id-revision"`
Hash256 params.HashResponse `json:"hash256"`
}
}
Even better would be to add a bulk meta method as a companion
to csclient.Client.Meta.
frankban
Mar 18, 2015
Member
Nice suggestion! Done.
csclient.BulkMeta is also a good idea, I'll investigate that later.
|
LGTM with one suggestion, thanks! |
added a commit
that referenced
this pull request
Mar 18, 2015
frankban
merged commit 979541a
into
juju:v5-unstable
Mar 18, 2015
|
Thanks for the reviews! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
frankban commentedMar 17, 2015
No description provided.