Upgrade AWS SKD to version v1.13.1
This commit is contained in:
parent
0c0949679f
commit
39eeb67d91
101 changed files with 39395 additions and 10063 deletions
96
vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go
generated
vendored
96
vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/doc.go
generated
vendored
|
@ -1,54 +1,82 @@
|
|||
// Package dynamodbattribute provides marshaling utilities for marshaling to
|
||||
// dynamodb.AttributeValue types and unmarshaling to Go value types. These
|
||||
// utilities allow you to marshal slices, maps, structs, and scalar values
|
||||
// Package dynamodbattribute provides marshaling and unmarshaling utilities to
|
||||
// convert between Go types and dynamodb.AttributeValues.
|
||||
//
|
||||
// These utilities allow you to marshal slices, maps, structs, and scalar values
|
||||
// to and from dynamodb.AttributeValue. These are useful when marshaling
|
||||
// Go value tyes to dynamodb.AttributeValue for DynamoDB requests, or
|
||||
// unmarshaling the dynamodb.AttributeValue back into a Go value type.
|
||||
//
|
||||
// Marshal Go value types to dynamodb.AttributeValue: See (ExampleMarshal)
|
||||
// AttributeValue Marshaling
|
||||
//
|
||||
// To marshal a Go type to a dynamodbAttributeValue you can use the Marshal
|
||||
// functions in the dynamodbattribute package. There are specialized versions
|
||||
// of these functions for collections of Attributevalue, such as maps and lists.
|
||||
//
|
||||
// The following example uses MarshalMap to convert the Record Go type to a
|
||||
// dynamodb.AttributeValue type and use the value to make a PutItem API request.
|
||||
//
|
||||
// type Record struct {
|
||||
// MyField string
|
||||
// Letters []string
|
||||
// A2Num map[string]int
|
||||
// ID string
|
||||
// URLs []string
|
||||
// }
|
||||
//
|
||||
// ...
|
||||
// //...
|
||||
//
|
||||
// r := Record{
|
||||
// MyField: "dynamodbattribute.Marshal example",
|
||||
// Letters: []string{"a", "b", "c", "d"},
|
||||
// A2Num: map[string]int{"a": 1, "b": 2, "c": 3},
|
||||
// ID: "ABC123",
|
||||
// URLs: []string{
|
||||
// "https://example.com/first/link",
|
||||
// "https://example.com/second/url",
|
||||
// },
|
||||
// }
|
||||
// av, err := dynamodbattribute.Marshal(r)
|
||||
// fmt.Println(av, err)
|
||||
//
|
||||
// Unmarshal dynamodb.AttributeValue to Go value type: See (ExampleUnmarshal)
|
||||
//
|
||||
// r2 := Record{}
|
||||
// err = dynamodbattribute.Unmarshal(av, &r2)
|
||||
// fmt.Println(err, reflect.DeepEqual(r, r2))
|
||||
//
|
||||
// Marshal Go value type for DynamoDB.PutItem:
|
||||
//
|
||||
// sess, err := session.NewSession()
|
||||
// av, err := dynamodbattribute.MarshalMap(r)
|
||||
// if err != nil {
|
||||
// fmt.Println("Failed create session", err)
|
||||
// return
|
||||
// panic(fmt.Sprintf("failed to DynamoDB marshal Record, %v", err))
|
||||
// }
|
||||
//
|
||||
// svc := dynamodb.New(sess)
|
||||
// item, err := dynamodbattribute.MarshalMap(r)
|
||||
// if err != nil {
|
||||
// fmt.Println("Failed to convert", err)
|
||||
// return
|
||||
// }
|
||||
// result, err := svc.PutItem(&dynamodb.PutItemInput{
|
||||
// Item: item,
|
||||
// TableName: aws.String("exampleTable"),
|
||||
// _, err = svc.PutItem(&dynamodb.PutItemInput{
|
||||
// TableName: aws.String(myTableName),
|
||||
// Item: av,
|
||||
// })
|
||||
// if err != nil {
|
||||
// panic(fmt.Sprintf("failed to put Record to DynamoDB, %v", err))
|
||||
// }
|
||||
//
|
||||
// AttributeValue Unmarshaling
|
||||
//
|
||||
// To unmarshal a dynamodb.AttributeValue to a Go type you can use the Unmarshal
|
||||
// functions in the dynamodbattribute package. There are specialized versions
|
||||
// of these functions for collections of Attributevalue, such as maps and lists.
|
||||
//
|
||||
// The following example will unmarshal the DynamoDB's Scan API operation. The
|
||||
// Items returned by the operation will be unmarshaled into the slice of Records
|
||||
// Go type.
|
||||
//
|
||||
// type Record struct {
|
||||
// ID string
|
||||
// URLs []string
|
||||
// }
|
||||
//
|
||||
// //...
|
||||
//
|
||||
// var records []Record
|
||||
//
|
||||
// // Use the ScanPages method to perform the scan with pagination. Use
|
||||
// // just Scan method to make the API call without pagination.
|
||||
// err := svc.ScanPages(&dynamodb.ScanInput{
|
||||
// TableName: aws.String(myTableName),
|
||||
// }, func(page *dynamodb.ScanOutput, last bool) bool {
|
||||
// recs := []Record{}
|
||||
//
|
||||
// err := dynamodbattribute.UnmarshalListOfMaps(page.Items, &recs)
|
||||
// if err != nil {
|
||||
// panic(fmt.Sprintf("failed to unmarshal Dynamodb Scan Items, %v", err))
|
||||
// }
|
||||
//
|
||||
// records = append(records, recs...)
|
||||
//
|
||||
// return true // keep paging
|
||||
// })
|
||||
//
|
||||
// The ConvertTo, ConvertToList, ConvertToMap, ConvertFrom, ConvertFromMap
|
||||
// and ConvertFromList methods have been deprecated. The Marshal and Unmarshal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue