sqs-browse: a lot of work to try to keep UI complexity down

Added the notion of controllers and a dispatcher which will queue up operations
This commit is contained in:
Leon Mika 2022-03-23 15:40:31 +11:00
parent 1969504611
commit 7526c095ee
24 changed files with 602 additions and 97 deletions

View file

@ -2,9 +2,11 @@ package tables
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/lmika/awstools/internal/dynamo-browse/models"
)
type TableProvider interface {
ScanItems(ctx context.Context, tableName string) ([]models.Item, error)
DeleteItem(ctx context.Context, tableName string, key map[string]types.AttributeValue) error
}

View file

@ -2,6 +2,7 @@ package tables
import (
"context"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/lmika/awstools/internal/dynamo-browse/models"
"github.com/pkg/errors"
"sort"
@ -50,3 +51,11 @@ func (s *Service) Scan(ctx context.Context, table string) (*models.ResultSet, er
Items: results,
}, nil
}
func (s *Service) Delete(ctx context.Context, name string, item models.Item) error {
// TODO: do not hardcode keys
return s.provider.DeleteItem(ctx, name, map[string]types.AttributeValue{
"pk": item["pk"],
"sk": item["sk"],
})
}