-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynamopower.go
42 lines (34 loc) · 1.01 KB
/
dynamopower.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
42
package dynamopower_go
import (
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/dynamopower/dynamopower-go/connections"
"github.com/dynamopower/dynamopower-go/model"
)
type DynamoPower struct {
connectionPool *connections.ConnectionPool
}
// Constructor
func NewDynamoPower() *DynamoPower {
return &DynamoPower{}
}
// Create table
func (this *DynamoPower) CreateTable(model model.Modeller) (*dynamodb.CreateTableOutput, error) {
}
// Build CreateTableInput
func (this *DynamoPower) buildCreateTableInput(model model.Modeller) *dynamodb.CreateTableInput {
hashKey, hashKeyType, rangeKey, rangeKeyType := model.GetKeys()
var attrDefs []*dynamodb.AttributeDefinition
attrDefs = append(attrDefs, &dynamodb.AttributeDefinition{
AttributeName: hashKey,
AttributeType: hashKeyType,
})
if rangeKey != "" {
attrDefs = append(attrDefs, &dynamodb.AttributeDefinition{
AttributeName: rangeKey,
AttributeType: rangeKeyType,
})
}
return &dynamodb.CreateTableInput{
AttributeDefinitions: attrDefs,
}
}