// QueryDeleter deletes all records that match the query
QueryDeleter deletes all records that match the query
// QueryDeleter deletes all records that match the query
func (c *Client) QueryDeleter(ctx context.Context, table string, input *dynamodb.QueryInput, keyFn KeyExtractor) error {
	err := c.QueryIterator(ctx, input, func(out *dynamodb.QueryOutput) error {
		requests := make([]*dynamodb.WriteRequest, 0, len(out.Items))
		for _, attrs := range out.Items {
			requests = append(requests, &dynamodb.WriteRequest{
				DeleteRequest: &dynamodb.DeleteRequest{
					Key: keyFn(attrs),
				},
			})
		}
		if _, err := c.BatchWriter(ctx, table, requests...); err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return err
	}
	return nil
}
func ( c * Client ) QueryDeleter ( ctx context . Context , table string , input * dynamodb . QueryInput , keyFn KeyExtractor ) error { err := c . QueryIterator ( ctx , input , func ( out * dynamodb . QueryOutput ) error { requests := make ( [ ] * dynamodb . WriteRequest , 0 , len ( out . Items ) ) for _ , attrs := range out . Items { requests = append ( requests , & dynamodb . WriteRequest { DeleteRequest : & dynamodb . DeleteRequest { Key : keyFn ( attrs ) , } , } ) } if _ , err := c . BatchWriter ( ctx , table , requests ... ) ; err != nil { return err } return nil } ) if err != nil { return err } return nil }
QueryDeleter deletes all records that match the query
QueryDeleter deletes all records that match the query