forked from aws/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
67 lines (67 loc) · 2.48 KB
/
doc.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 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
// 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)
//
// type Record struct {
// MyField string
// Letters []string
// A2Num map[string]int
// }
//
// ...
//
// r := Record{
// MyField: "dynamodbattribute.Marshal example",
// Letters: []string{"a", "b", "c", "d"},
// A2Num: map[string]int{"a": 1, "b": 2, "c": 3},
// }
// 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()
// if err != nil {
// fmt.Println("Failed create session", err)
// return
// }
//
// 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"),
// })
//
//
//
// The ConvertTo, ConvertToList, ConvertToMap, ConvertFrom, ConvertFromMap
// and ConvertFromList methods have been deprecated. The Marshal and Unmarshal
// functions should be used instead. The ConvertTo|From marshallers do not
// support BinarySet, NumberSet, nor StringSets, and will incorrect marshal
// binary data fields in structs as base64 strings.
//
// The Marshal and Unmarshal functions correct this behavior, and removes
// the reliance on encoding.json. `json` struct tags are still supported. In
// addition support for a new struct tag `dynamodbav` was added. Support for
// the json.Marshaler and json.Unmarshaler interfaces have been removed and
// replaced with have been replaced with dynamodbattribute.Marshaler and
// dynamodbattribute.Unmarshaler interfaces.
//
// `time.Time` is marshaled as RFC3339 format.
package dynamodbattribute