// BatchPut allows you to put a batch of items to a table
// items will me converted to a marshal map
BatchPut allows you to put a batch of items to a table
items will me converted to a marshal map
// BatchPut allows you to put a batch of items to a table // items will me converted to a marshal map
func (c *Client) BatchPut(ctx context.Context, tableName string, items ...interface{}) (int, error) {
	arr := make([]interface{}, 0, len(items))
	for _, a := range items {
		vals := sliceToValues(a)
		if vals == nil {
			arr = append(arr, a)
		} else {
			arr = append(arr, vals...)
		}
	}
	requests := make([]*dynamodb.WriteRequest, 0, len(arr))
	for _, a := range arr {
		data, err := dynamodbattribute.MarshalMap(a)
		if err != nil {
			return 0, err
		}
		requests = append(requests, &dynamodb.WriteRequest{
			PutRequest: &dynamodb.PutRequest{
				Item: data,
			},
		})
	}
	return c.BatchWriter(ctx, tableName, requests...)
}
func ( c * Client ) BatchPut ( ctx context . Context , tableName string , items ... interface { } ) ( int , error ) { arr := make ( [ ] interface { } , 0 , len ( items ) ) for _ , a := range items { vals := sliceToValues ( a ) if vals == nil { arr = append ( arr , a ) } else { arr = append ( arr , vals ... ) } } requests := make ( [ ] * dynamodb . WriteRequest , 0 , len ( arr ) ) for _ , a := range arr { data , err := dynamodbattribute . MarshalMap ( a ) if err != nil { return 0 , err } requests = append ( requests , & dynamodb . WriteRequest { PutRequest : & dynamodb . PutRequest { Item : data , } , } ) } return c . BatchWriter ( ctx , tableName , requests ... ) }
BatchPut allows you to put a batch of items to a table
items will me converted to a marshal map
BatchPut allows you to put a batch of items to a table items will me converted to a marshal map