| 1 |
package gfx |
| 2 |
|
| 3 |
import ( |
| 4 |
"apimethods" |
| 5 |
"fmt" |
| 6 |
) |
| 7 |
|
| 8 |
//ChooseAPIMethod ... Pick a method call based on menu entry |
| 9 |
func ChooseAPIMethod(api string) { |
| 10 |
|
| 11 |
switch api { |
| 12 |
|
| 13 |
case "batchgetdocuments": |
| 14 |
fallthrough |
| 15 |
case "1": |
| 16 |
apimethods.BatchGetDocuments() |
| 17 |
|
| 18 |
case "begintransaction": |
| 19 |
fallthrough |
| 20 |
case "2": |
| 21 |
apimethods.BeginTransaction() |
| 22 |
|
| 23 |
case "commit": |
| 24 |
fallthrough |
| 25 |
case "3": |
| 26 |
apimethods.Commit() |
| 27 |
|
| 28 |
case "createdocument": |
| 29 |
fallthrough |
| 30 |
case "4": |
| 31 |
apimethods.CreateDocument() |
| 32 |
|
| 33 |
case "deletedocument": |
| 34 |
fallthrough |
| 35 |
case "5": |
| 36 |
apimethods.DeleteDocument() |
| 37 |
|
| 38 |
case "getdocument": |
| 39 |
fallthrough |
| 40 |
case "6": |
| 41 |
apimethods.GetDocument() |
| 42 |
|
| 43 |
case "listcollectionids": |
| 44 |
fallthrough |
| 45 |
case "7": |
| 46 |
apimethods.ListCollectionIds() |
| 47 |
|
| 48 |
case "listdocuments": |
| 49 |
fallthrough |
| 50 |
case "8": |
| 51 |
apimethods.ListDocuments() |
| 52 |
|
| 53 |
case "rollback": |
| 54 |
fallthrough |
| 55 |
case "9": |
| 56 |
apimethods.Rollback() |
| 57 |
|
| 58 |
case "runquery": |
| 59 |
fallthrough |
| 60 |
case "10": |
| 61 |
apimethods.RunQuery() |
| 62 |
|
| 63 |
case "updatedocument": |
| 64 |
fallthrough |
| 65 |
case "11": |
| 66 |
apimethods.UpdateDocument() |
| 67 |
|
| 68 |
case "write": |
| 69 |
fallthrough |
| 70 |
case "12": |
| 71 |
apimethods.Write() |
| 72 |
|
| 73 |
case "createindex": |
| 74 |
fallthrough |
| 75 |
case "13": |
| 76 |
apimethods.CreateIndex() |
| 77 |
|
| 78 |
case "deleteindex": |
| 79 |
fallthrough |
| 80 |
case "14": |
| 81 |
apimethods.DeleteIndex() |
| 82 |
|
| 83 |
case "getindex": |
| 84 |
fallthrough |
| 85 |
case "15": |
| 86 |
apimethods.GetIndex() |
| 87 |
|
| 88 |
case "listindexes": |
| 89 |
fallthrough |
| 90 |
case "16": |
| 91 |
apimethods.ListIndexes() |
| 92 |
|
| 93 |
default: |
| 94 |
fmt.Println("Unknown option '", api, "'") |
| 95 |
|
| 96 |
} |
| 97 |
|
| 98 |
} |