-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
41 lines (35 loc) · 1.49 KB
/
commands.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import "github.com/c-bata/go-prompt"
var (
DatabaseCommand = prompt.Suggest{Text: "DATABASE", Description: ""}
DatabasesCommand = prompt.Suggest{Text: "DATABASES", Description: "Find all databases"}
RecordCommand = prompt.Suggest{Text: "RECORD", Description: ""}
RecordsCommand = prompt.Suggest{Text: "RECORDS", Description: "Find all records"}
TransactionsCommand = prompt.Suggest{Text: "TRANSACTIONS", Description: "Find changes on current transactions"}
DBCommands = []prompt.Suggest{
{Text: "NEW", Description: "Creates new database"},
{Text: "USE", Description: "Use a specific database"},
}
TXCommands = []prompt.Suggest{
{Text: "BEGIN", Description: "Begins a transaction"},
{Text: "COMMIT", Description: "Commits a transaction"},
{Text: "COUNT", Description: "Retreives the number of key/velues stored"},
{Text: "DELETE", Description: "Deletes a value based on a key"},
{Text: "END", Description: "Ends a transaction"},
{Text: "EXIT", Description: "Exits the console"},
{Text: "GET", Description: "Gets a value based on a key"},
{Text: "LIST", Description: "Lists all databases/Lists all key/values stored"},
{Text: "ROLLBACK", Description: "Rolls back a transaction"},
{Text: "SET", Description: "Sets a key to a certain value"},
}
)
func GetAllSuggestions() []prompt.Suggest {
cmd := []prompt.Suggest{}
for _, v := range DBCommands {
cmd = append(cmd, v)
}
for _, v := range TXCommands {
cmd = append(cmd, v)
}
return cmd
}