MCPcopy Create free account
hub / github.com/dbProjectRED/redimo.go / newClient

Function newClient

redimo_test.go:31–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func newClient(t *testing.T) Client {
32 t.Parallel()
33
34 tableName := uuid.New().String()
35 indexName := "idx"
36 partitionKey := "pk"
37 sortKey := "sk"
38 sortKeyNum := "skN"
39 dynamoService := dynamodb.New(newConfig(t))
40 _, err := dynamoService.CreateTableRequest(&dynamodb.CreateTableInput{
41 AttributeDefinitions: []dynamodb.AttributeDefinition{
42 {AttributeName: aws.String(partitionKey), AttributeType: "S"},
43 {AttributeName: aws.String(sortKey), AttributeType: "S"},
44 {AttributeName: aws.String(sortKeyNum), AttributeType: "N"},
45 },
46 BillingMode: "",
47 GlobalSecondaryIndexes: nil,
48 KeySchema: []dynamodb.KeySchemaElement{
49 {AttributeName: aws.String(partitionKey), KeyType: dynamodb.KeyTypeHash},
50 {AttributeName: aws.String(sortKey), KeyType: dynamodb.KeyTypeRange},
51 },
52 LocalSecondaryIndexes: []dynamodb.LocalSecondaryIndex{
53 {
54 IndexName: aws.String(indexName),
55 KeySchema: []dynamodb.KeySchemaElement{
56 {AttributeName: aws.String(partitionKey), KeyType: dynamodb.KeyTypeHash},
57 {AttributeName: aws.String(sortKeyNum), KeyType: dynamodb.KeyTypeRange},
58 },
59 Projection: &dynamodb.Projection{
60 NonKeyAttributes: nil,
61 ProjectionType: dynamodb.ProjectionTypeKeysOnly,
62 },
63 },
64 },
65 ProvisionedThroughput: &dynamodb.ProvisionedThroughput{
66 ReadCapacityUnits: aws.Int64(1),
67 WriteCapacityUnits: aws.Int64(1),
68 },
69 SSESpecification: nil,
70 StreamSpecification: nil,
71 TableName: aws.String(tableName),
72 Tags: nil,
73 }).Send(context.TODO())
74 assert.NoError(t, err)
75
76 return NewClient(dynamoService).Table(tableName, indexName).Attributes(partitionKey, sortKey, sortKeyNum)
77}
78
79func newConfig(t *testing.T) aws.Config {
80 cfgs := external.Configs{}

Callers 15

TestLBasicsFunction · 0.85
TestRPOPLPUSHFunction · 0.85
TestListIndexBasedCRUDFunction · 0.85
TestListValueBasedCRUDFunction · 0.85
TestStreamCRUFunction · 0.85
TestStreamDeletesFunction · 0.85
TestRangesFunction · 0.85
TestBasicSetsFunction · 0.85
TestSetOperationsFunction · 0.85
TestSetModifiersFunction · 0.85

Calls 5

newConfigFunction · 0.85
NewClientFunction · 0.85
AttributesMethod · 0.80
TableMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected