A few various changes

- Fixed the '-local' flag to accept host and port
- Added a '-debug' flag to accept a file to write debug log messages
- Added some logic which will force the dark background flag on if MacOS is in dark mode
This commit is contained in:
Leon Mika 2022-06-16 22:00:25 +10:00
parent 47e404aff7
commit 41af399215
18 changed files with 191 additions and 68 deletions

View file

@ -2,24 +2,23 @@ package main
import (
"context"
"github.com/brianvoe/gofakeit/v6"
"github.com/google/uuid"
"log"
"strconv"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
"github.com/aws/aws-sdk-go-v2/service/dynamodb/types"
"github.com/brianvoe/gofakeit/v6"
"github.com/google/uuid"
"github.com/lmika/awstools/internal/dynamo-browse/models"
"github.com/lmika/awstools/internal/dynamo-browse/providers/dynamo"
"github.com/lmika/awstools/internal/dynamo-browse/services/tables"
"github.com/lmika/gopkgs/cli"
"log"
)
func main() {
ctx := context.Background()
tableName := "awstools-test"
tableName := "business-addresses"
totalItems := 5000
cfg, err := config.LoadDefaultConfig(ctx)
@ -67,21 +66,18 @@ func main() {
for i := 0; i < totalItems; i++ {
key := uuid.New().String()
if err := tableService.Put(ctx, tableInfo, models.Item{
"pk": &types.AttributeValueMemberS{Value: key},
"sk": &types.AttributeValueMemberS{Value: key},
"name": &types.AttributeValueMemberS{Value: gofakeit.Name()},
"address": &types.AttributeValueMemberS{Value: gofakeit.Address().Address},
"city": &types.AttributeValueMemberS{Value: gofakeit.Address().City},
"phone": &types.AttributeValueMemberN{Value: gofakeit.Phone()},
"web": &types.AttributeValueMemberS{Value: gofakeit.URL()},
"inOffice": &types.AttributeValueMemberBOOL{Value: gofakeit.Bool()},
"pk": &types.AttributeValueMemberS{Value: key},
"sk": &types.AttributeValueMemberS{Value: key},
"name": &types.AttributeValueMemberS{Value: gofakeit.Name()},
"address": &types.AttributeValueMemberS{Value: gofakeit.Address().Address},
"city": &types.AttributeValueMemberS{Value: gofakeit.Address().City},
"phone": &types.AttributeValueMemberN{Value: gofakeit.Phone()},
"web": &types.AttributeValueMemberS{Value: gofakeit.URL()},
"officeOpened": &types.AttributeValueMemberBOOL{Value: gofakeit.Bool()},
"ratings": &types.AttributeValueMemberL{Value: []types.AttributeValue{
&types.AttributeValueMemberS{Value: gofakeit.Adverb()},
&types.AttributeValueMemberN{Value: "12.34"},
}},
"values": &types.AttributeValueMemberM{Value: map[string]types.AttributeValue{
"adverb": &types.AttributeValueMemberS{Value: gofakeit.Adverb()},
"int": &types.AttributeValueMemberN{Value: strconv.Itoa(int(gofakeit.Int32()))},
&types.AttributeValueMemberN{Value: fmt.Sprint(gofakeit.IntRange(0, 5))},
&types.AttributeValueMemberN{Value: fmt.Sprint(gofakeit.IntRange(0, 5))},
&types.AttributeValueMemberN{Value: fmt.Sprint(gofakeit.IntRange(0, 5))},
}},
}); err != nil {
log.Fatalln(err)