-
Notifications
You must be signed in to change notification settings - Fork 0
/
iface.go
38 lines (30 loc) · 1.09 KB
/
iface.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
package scriptmanager
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/lmika/dynamo-browse/internal/dynamo-browse/models"
)
//go:generate mockery --with-expecter --name UIService
//go:generate mockery --with-expecter --name SessionService
type Ifaces struct {
UI UIService
Session SessionService
}
type UIService interface {
PrintMessage(ctx context.Context, msg string)
// Prompt should return a channel which will provide the input from the user. If the user
// provides no input, prompt should close the channel without providing anything.
Prompt(ctx context.Context, msg string) chan string
}
type SessionService interface {
Query(ctx context.Context, expr string, queryOptions QueryOptions) (*models.ResultSet, error)
ResultSet(ctx context.Context) *models.ResultSet
SelectedItemIndex(ctx context.Context) int
SetResultSet(ctx context.Context, newResultSet *models.ResultSet)
}
type QueryOptions struct {
TableName string
IndexName string
NamePlaceholders map[string]string
ValuePlaceholders map[string]types.AttributeValue
}