本文整理汇总了Golang中github.com/convox/rack/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/dynamodb.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestMain
func TestMain(m *testing.M) {
db = dynamodb.New(unit.Session, &aws.Config{
MaxRetries: aws.Int(2),
})
db.Handlers.Send.Clear() // mock sending
os.Exit(m.Run())
}
开发者ID:kuenzaa,项目名称:rack,代码行数:8,代码来源:customizations_test.go
示例2: TestPaginationEachPage
// Use DynamoDB methods for simplicity
func TestPaginationEachPage(t *testing.T) {
db := dynamodb.New(unit.Session)
tokens, pages, numPages, gotToEnd := []string{}, []string{}, 0, false
reqNum := 0
resps := []*dynamodb.ListTablesOutput{
{TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
{TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
{TableNames: []*string{aws.String("Table5")}},
}
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
db.Handlers.Build.PushBack(func(r *request.Request) {
in := r.Params.(*dynamodb.ListTablesInput)
if in == nil {
tokens = append(tokens, "")
} else if in.ExclusiveStartTableName != nil {
tokens = append(tokens, *in.ExclusiveStartTableName)
}
})
db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
req, _ := db.ListTablesRequest(params)
err := req.EachPage(func(p interface{}, last bool) bool {
numPages++
for _, t := range p.(*dynamodb.ListTablesOutput).TableNames {
pages = append(pages, *t)
}
if last {
if gotToEnd {
assert.Fail(t, "last=true happened twice")
}
gotToEnd = true
}
return true
})
assert.Equal(t, []string{"Table2", "Table4"}, tokens)
assert.Equal(t, []string{"Table1", "Table2", "Table3", "Table4", "Table5"}, pages)
assert.Equal(t, 3, numPages)
assert.True(t, gotToEnd)
assert.Nil(t, err)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:52,代码来源:request_pagination_test.go
示例3: TestValidateCRC32DoesNotMatchNoComputeChecksum
func TestValidateCRC32DoesNotMatchNoComputeChecksum(t *testing.T) {
svc := dynamodb.New(unit.Session, &aws.Config{
MaxRetries: aws.Int(2),
DisableComputeChecksums: aws.Bool(true),
})
svc.Handlers.Send.Clear() // mock sending
req := mockCRCResponse(svc, 200, `{"TableNames":["A"]}`, "1234")
assert.NoError(t, req.Error)
assert.Equal(t, 0, int(req.RetryCount))
// CRC check disabled. Does not affect output parsing
out := req.Data.(*dynamodb.ListTablesOutput)
assert.Equal(t, "A", *out.TableNames[0])
}
开发者ID:kuenzaa,项目名称:rack,代码行数:16,代码来源:customizations_test.go
示例4: ExampleDynamoDB_DescribeTable
func ExampleDynamoDB_DescribeTable() {
svc := dynamodb.New(session.New())
params := &dynamodb.DescribeTableInput{
TableName: aws.String("TableName"), // Required
}
resp, err := svc.DescribeTable(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:18,代码来源:examples_test.go
示例5: ExampleDynamoDB_ListTables
func ExampleDynamoDB_ListTables() {
svc := dynamodb.New(session.New())
params := &dynamodb.ListTablesInput{
ExclusiveStartTableName: aws.String("TableName"),
Limit: aws.Int64(1),
}
resp, err := svc.ListTables(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:19,代码来源:examples_test.go
示例6: TestPaginationEarlyExit
// Use DynamoDB methods for simplicity
func TestPaginationEarlyExit(t *testing.T) {
db := dynamodb.New(unit.Session)
numPages, gotToEnd := 0, false
reqNum := 0
resps := []*dynamodb.ListTablesOutput{
{TableNames: []*string{aws.String("Table1"), aws.String("Table2")}, LastEvaluatedTableName: aws.String("Table2")},
{TableNames: []*string{aws.String("Table3"), aws.String("Table4")}, LastEvaluatedTableName: aws.String("Table4")},
{TableNames: []*string{aws.String("Table5")}},
}
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &dynamodb.ListTablesInput{Limit: aws.Int64(2)}
err := db.ListTablesPages(params, func(p *dynamodb.ListTablesOutput, last bool) bool {
numPages++
if numPages == 2 {
return false
}
if last {
if gotToEnd {
assert.Fail(t, "last=true happened twice")
}
gotToEnd = true
}
return true
})
assert.Equal(t, 2, numPages)
assert.False(t, gotToEnd)
assert.Nil(t, err)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:40,代码来源:request_pagination_test.go
示例7: TestCustomRetryRules
func TestCustomRetryRules(t *testing.T) {
d := dynamodb.New(unit.Session, &aws.Config{MaxRetries: aws.Int(2)})
assert.Equal(t, d.MaxRetries(), 2)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:4,代码来源:customizations_test.go
示例8: TestDefaultRetryRules
func TestDefaultRetryRules(t *testing.T) {
d := dynamodb.New(unit.Session, &aws.Config{MaxRetries: aws.Int(-1)})
assert.Equal(t, d.MaxRetries(), 10)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:4,代码来源:customizations_test.go
示例9: TestPaginationQueryPage
// Use DynamoDB methods for simplicity
func TestPaginationQueryPage(t *testing.T) {
db := dynamodb.New(unit.Session)
tokens, pages, numPages, gotToEnd := []map[string]*dynamodb.AttributeValue{}, []map[string]*dynamodb.AttributeValue{}, 0, false
reqNum := 0
resps := []*dynamodb.QueryOutput{
{
LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}},
Count: aws.Int64(1),
Items: []map[string]*dynamodb.AttributeValue{
map[string]*dynamodb.AttributeValue{
"key": {S: aws.String("key1")},
},
},
},
{
LastEvaluatedKey: map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}},
Count: aws.Int64(1),
Items: []map[string]*dynamodb.AttributeValue{
map[string]*dynamodb.AttributeValue{
"key": {S: aws.String("key2")},
},
},
},
{
LastEvaluatedKey: map[string]*dynamodb.AttributeValue{},
Count: aws.Int64(1),
Items: []map[string]*dynamodb.AttributeValue{
map[string]*dynamodb.AttributeValue{
"key": {S: aws.String("key3")},
},
},
},
}
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
db.Handlers.Build.PushBack(func(r *request.Request) {
in := r.Params.(*dynamodb.QueryInput)
if in == nil {
tokens = append(tokens, nil)
} else if len(in.ExclusiveStartKey) != 0 {
tokens = append(tokens, in.ExclusiveStartKey)
}
})
db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
r.Data = resps[reqNum]
reqNum++
})
params := &dynamodb.QueryInput{
Limit: aws.Int64(2),
TableName: aws.String("tablename"),
}
err := db.QueryPages(params, func(p *dynamodb.QueryOutput, last bool) bool {
numPages++
for _, item := range p.Items {
pages = append(pages, item)
}
if last {
if gotToEnd {
assert.Fail(t, "last=true happened twice")
}
gotToEnd = true
}
return true
})
assert.Nil(t, err)
assert.Equal(t,
[]map[string]*dynamodb.AttributeValue{
map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}},
map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}},
}, tokens)
assert.Equal(t,
[]map[string]*dynamodb.AttributeValue{
map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key1")}},
map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key2")}},
map[string]*dynamodb.AttributeValue{"key": {S: aws.String("key3")}},
}, pages)
assert.Equal(t, 3, numPages)
assert.True(t, gotToEnd)
assert.Nil(t, params.ExclusiveStartKey)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:87,代码来源:request_pagination_test.go
示例10: DynamoDB
func DynamoDB() *dynamodb.DynamoDB {
return dynamodb.New(session.New(), awsConfig())
}
开发者ID:soulware,项目名称:rack,代码行数:3,代码来源:models.go
示例11: dynamodb
func (p *AWSProvider) dynamodb() *dynamodb.DynamoDB {
return dynamodb.New(session.New(), p.config())
}
开发者ID:soulware,项目名称:rack,代码行数:3,代码来源:aws.go
示例12: ExampleDynamoDB_Scan
func ExampleDynamoDB_Scan() {
svc := dynamodb.New(session.New())
params := &dynamodb.ScanInput{
TableName: aws.String("TableName"), // Required
AttributesToGet: []*string{
aws.String("AttributeName"), // Required
// More values...
},
ConditionalOperator: aws.String("ConditionalOperator"),
ConsistentRead: aws.Bool(true),
ExclusiveStartKey: map[string]*dynamodb.AttributeValue{
"Key": { // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
ExpressionAttributeNames: map[string]*string{
"Key": aws.String("AttributeName"), // Required
// More values...
},
ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{
"Key": { // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
FilterExpression: aws.String("ConditionExpression"),
IndexName: aws.String("IndexName"),
Limit: aws.Int64(1),
ProjectionExpression: aws.String("ProjectionExpression"),
ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
ScanFilter: map[string]*dynamodb.Condition{
"Key": { // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
AttributeValueList: []*dynamodb.AttributeValue{
{ // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
//.........这里部分代码省略.........
开发者ID:kuenzaa,项目名称:rack,代码行数:101,代码来源:examples_test.go
示例13: ExampleDynamoDB_BatchWriteItem
func ExampleDynamoDB_BatchWriteItem() {
svc := dynamodb.New(session.New())
params := &dynamodb.BatchWriteItemInput{
RequestItems: map[string][]*dynamodb.WriteRequest{ // Required
"Key": { // Required
{ // Required
DeleteRequest: &dynamodb.DeleteRequest{
Key: map[string]*dynamodb.AttributeValue{ // Required
"Key": { // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
},
PutRequest: &dynamodb.PutRequest{
Item: map[string]*dynamodb.AttributeValue{ // Required
"Key": { // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
},
},
// More values...
},
// More values...
},
ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
ReturnItemCollectionMetrics: aws.String("ReturnItemCollectionMetrics"),
}
resp, err := svc.BatchWriteItem(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:99,代码来源:examples_test.go
示例14: ExampleDynamoDB_PutItem
func ExampleDynamoDB_PutItem() {
svc := dynamodb.New(session.New())
params := &dynamodb.PutItemInput{
Item: map[string]*dynamodb.AttributeValue{ // Required
"Key": { // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
TableName: aws.String("TableName"), // Required
ConditionExpression: aws.String("ConditionExpression"),
ConditionalOperator: aws.String("ConditionalOperator"),
Expected: map[string]*dynamodb.ExpectedAttributeValue{
"Key": { // Required
AttributeValueList: []*dynamodb.AttributeValue{
{ // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
ComparisonOperator: aws.String("ComparisonOperator"),
Exists: aws.Bool(true),
Value: &dynamodb.AttributeValue{
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
//.........这里部分代码省略.........
开发者ID:kuenzaa,项目名称:rack,代码行数:101,代码来源:examples_test.go
示例15: ExampleDynamoDB_GetItem
func ExampleDynamoDB_GetItem() {
svc := dynamodb.New(session.New())
params := &dynamodb.GetItemInput{
Key: map[string]*dynamodb.AttributeValue{ // Required
"Key": { // Required
B: []byte("PAYLOAD"),
BOOL: aws.Bool(true),
BS: [][]byte{
[]byte("PAYLOAD"), // Required
// More values...
},
L: []*dynamodb.AttributeValue{
{ // Required
// Recursive values...
},
// More values...
},
M: map[string]*dynamodb.AttributeValue{
"Key": { // Required
// Recursive values...
},
// More values...
},
N: aws.String("NumberAttributeValue"),
NS: []*string{
aws.String("NumberAttributeValue"), // Required
// More values...
},
NULL: aws.Bool(true),
S: aws.String("StringAttributeValue"),
SS: []*string{
aws.String("StringAttributeValue"), // Required
// More values...
},
},
// More values...
},
TableName: aws.String("TableName"), // Required
AttributesToGet: []*string{
aws.String("AttributeName"), // Required
// More values...
},
ConsistentRead: aws.Bool(true),
ExpressionAttributeNames: map[string]*string{
"Key": aws.String("AttributeName"), // Required
// More values...
},
ProjectionExpression: aws.String("ProjectionExpression"),
ReturnConsumedCapacity: aws.String("ReturnConsumedCapacity"),
}
resp, err := svc.GetItem(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:63,代码来源:examples_test.go
示例16: BenchmarkCodegenIterator
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE"), aws.String("NXT")}, LastEvaluatedTableName: aws.String("NXT")},
{TableNames: []*string{aws.String("TABLE")}},
}
var benchDb = func() *dynamodb.DynamoDB {
db := dynamodb.New(unit.Session)
db.Handlers.Send.Clear() // mock sending
db.Handlers.Unmarshal.Clear()
db.Handlers.UnmarshalMeta.Clear()
db.Handlers.ValidateResponse.Clear()
return db
}
func BenchmarkCodegenIterator(b *testing.B) {
reqNum := 0
db := benchDb()
db.Handlers.Unmarshal.PushBack(func(r *request.Request) {
r.Data = benchResps[reqNum]
reqNum++
})
开发者ID:kuenzaa,项目名称:rack,代码行数:30,代码来源:request_pagination_test.go
示例17: DynamoDB
func DynamoDB() *dynamodb.DynamoDB {
return dynamodb.New(awsConfig())
}
开发者ID:gisnalbert,项目名称:rack,代码行数:3,代码来源:models.go
示例18: ExampleDynamoDB_CreateTable
func ExampleDynamoDB_CreateTable() {
svc := dynamodb.New(session.New())
params := &dynamodb.CreateTableInput{
AttributeDefinitions: []*dynamodb.AttributeDefinition{ // Required
{ // Required
AttributeName: aws.String("KeySchemaAttributeName"), // Required
AttributeType: aws.String("ScalarAttributeType"), // Required
},
// More values...
},
KeySchema: []*dynamodb.KeySchemaElement{ // Required
{ // Required
AttributeName: aws.String("KeySchemaAttributeName"), // Required
KeyType: aws.String("KeyType"), // Required
},
// More values...
},
ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required
ReadCapacityUnits: aws.Int64(1), // Required
WriteCapacityUnits: aws.Int64(1), // Required
},
TableName: aws.String("TableName"), // Required
GlobalSecondaryIndexes: []*dynamodb.GlobalSecondaryIndex{
{ // Required
IndexName: aws.String("IndexName"), // Required
KeySchema: []*dynamodb.KeySchemaElement{ // Required
{ // Required
AttributeName: aws.String("KeySchemaAttributeName"), // Required
KeyType: aws.String("KeyType"), // Required
},
// More values...
},
Projection: &dynamodb.Projection{ // Required
NonKeyAttributes: []*string{
aws.String("NonKeyAttributeName"), // Required
// More values...
},
ProjectionType: aws.String("ProjectionType"),
},
ProvisionedThroughput: &dynamodb.ProvisionedThroughput{ // Required
ReadCapacityUnits: aws.Int64(1), // Required
WriteCapacityUnits: aws.Int64(1), // Required
},
},
// More values...
},
LocalSecondaryIndexes: []*dynamodb.LocalSecondaryIndex{
{ // Required
IndexName: aws.String("IndexName"), // Required
KeySchema: []*dynamodb.KeySchemaElement{ // Required
{ // Required
AttributeName: aws.String("KeySchemaAttributeName"), // Required
KeyType: aws.String("KeyType"), // Required
},
// More values...
},
Projection: &dynamodb.Projection{ // Required
NonKeyAttributes: []*string{
aws.String("NonKeyAttributeName"), // Required
// More values...
},
ProjectionType: aws.String("ProjectionType"),
},
},
// More values...
},
StreamSpecification: &dynamodb.StreamSpecification{
StreamEnabled: aws.Bool(true),
StreamViewType: aws.String("StreamViewType"),
},
}
resp, err := svc.CreateTable(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
开发者ID:kuenzaa,项目名称:rack,代码行数:84,代码来源:examples_test.go
注:本文中的github.com/convox/rack/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/dynamodb.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论