1// Package attributevalue provides marshaling and unmarshaling utilities to 2// convert between Go types and Amazon DynamoDB Streams AttributeValues. 3// 4// These utilities allow you to marshal slices, maps, structs, and scalar 5// values to and from the AttributeValue type. These utilities make it 6// easier to convert between AttributeValue and Go types when working with 7// DynamoDB resources. 8// 9// This package only converts between Go types and DynamoDBStreams 10// AttributeValue. See the feature/dynamodb/attributevalue package for 11// converting to DynamoDB AttributeValue types. 12// 13// Converting AttributeValue between DynamoDB and DynamoDBStreams 14// 15// The FromDynamoDBMap, FromDynamoDBList, and FromDynamoDB functions provide 16// the conversion utilities to convert a DynamoDB AttributeValue type to a 17// DynamoDBStreams AttributeValue type. Use these utilities when you need to 18// convert the AttributeValue type between the two APIs. 19// 20// AttributeValue Unmarshaling 21// 22// To unmarshal an AttributeValue to a Go type you can use the Unmarshal, 23// UnmarshalList, UnmarshalMap, and UnmarshalListOfMaps functions. The List and 24// Map functions are specialized versions of the Unmarshal function for 25// unmarshal slices and maps of Attributevalues. 26// 27// The following example will unmarshal Items result from the DynamoDBStreams 28// GetRecords operation. The items returned will be unmarshaled into the slice 29// of the Records struct. 30// 31// type Record struct { 32// ID string 33// URLs []string 34// } 35// 36// //... 37// 38// result, err := client.GetRecords(context.Context(), &dynamodbstreams.GetRecordsInput{ 39// ShardIterator: &shardIterator, 40// }) 41// if err != nil { 42// return fmt.Errorf("failed to get records from stream, %w", err) 43// } 44// 45// var records []Record 46// for _, ddbRecord := range result.Records { 47// if record.DynamoDB == nil { 48// continue 49// } 50// 51// var record 52// err := attributevalue.UnmarshalMap(ddbRecord.NewImage, &record) 53// if err != nil { 54// return fmt.Errorf("failed to unmarshal record, %w", err)) 55// } 56// records = append(records, record) 57// } 58// 59// Struct tags 60// 61// The AttributeValue Marshal and Unmarshal functions support the `dynamodbav` 62// struct tag by default. Additional tags can be enabled with the 63// EncoderOptions and DecoderOptions, TagKey option. 64// 65// See the Marshal and Unmarshal function for information on how struct tags 66// and fields are marshaled and unmarshaled. 67package attributevalue 68