Fix syntax in go client example

This commit is contained in:
Alan Bernstein 2018-05-11 14:41:04 -05:00
parent 7783716f37
commit 09302050ec

View file

@ -55,12 +55,12 @@ func main() {
// Which repositories did user 14 star:
response, _ = client.Query(stargazer.Bitmap(14))
fmt.Println("User 14 starred: ", response.Result().Bitmap.Bits)
fmt.Println("User 14 starred: ", response.Result().Bitmap().Bits)
// What are the top 5 languages in the sample data?
response, err = client.Query(language.TopN(5))
languageIDs := []uint64{}
for _, item := range response.Result().CountItems {
for _, item := range response.Result().CountItems() {
languageIDs = append(languageIDs, item.ID)
}
fmt.Println("Top 5 languages: ", languageIDs)
@ -70,14 +70,14 @@ func main() {
repository.Intersect(
stargazer.Bitmap(14),
stargazer.Bitmap(19)))
fmt.Println("Both user 14 and 19 starred:", response.Result().Bitmap.Bits)
fmt.Println("Both user 14 and 19 starred:", response.Result().Bitmap().Bits)
// Which repositories were starred by user 14 or 19:
response, _ = client.Query(
repository.Union(
stargazer.Bitmap(14),
stargazer.Bitmap(19)))
fmt.Println("User 14 or 19 starred:", response.Result().Bitmap.Bits)
fmt.Println("User 14 or 19 starred:", response.Result().Bitmap().Bits)
// Which repositories were starred by user 14 or 19 and were written in language 1:
response, _ = client.Query(
@ -87,7 +87,7 @@ func main() {
stargazer.Bitmap(19),
),
language.Bitmap(1)))
fmt.Println("User 14 or 19 starred, written in language 1:", response.Result().Bitmap.Bits)
fmt.Println("User 14 or 19 starred, written in language 1:", response.Result().Bitmap().Bits)
// Set user 99999 as a stargazer for repository 77777?
client.Query(stargazer.SetBit(99999, 77777))