| 1 |
package apimethods |
| 2 |
|
| 3 |
import ( |
| 4 |
"context" |
| 5 |
"fmt" |
| 6 |
"fsutils" |
| 7 |
admin "go-genproto/googleapis/firestore/admin/v1beta1" |
| 8 |
"userutil" |
| 9 |
) |
| 10 |
|
| 11 |
//ListIndexes ... List All indexes in a Database |
| 12 |
func ListIndexes() { |
| 13 |
fmt.Println("\n:: Listing All Indexes ::\n") |
| 14 |
|
| 15 |
client, conn := fsutils.MakeFSAdminClient() |
| 16 |
|
| 17 |
defer conn.Close() |
| 18 |
|
| 19 |
listIndexesReq := admin.ListIndexesRequest{ |
| 20 |
Parent: "projects/firestoretestclient/databases/(default)", |
| 21 |
} |
| 22 |
|
| 23 |
resp, err := client.ListIndexes(context.Background(), &listIndexesReq) |
| 24 |
if err != nil { |
| 25 |
fmt.Println(err) |
| 26 |
return |
| 27 |
} |
| 28 |
|
| 29 |
for _, ind := range resp.Indexes { |
| 30 |
userutil.DrawIndex(*ind) |
| 31 |
} |
| 32 |
|
| 33 |
return |
| 34 |
} |