Home How to remove all data from DynamoDB without for loop?
Reply: 0

How to remove all data from DynamoDB without for loop?

user647
1#
user647 Published in May 28, 2018, 5:03 am

Suppose i have 100 data in DynamoDB then to remove all data i have to execute for loop .So is there any way to remove all data without for loop ?

let dynamoDbObjectMapper = AWSDynamoDBObjectMapper.default()

for var key in 0 ..<100 {

    let itemToDelete: CategoriesDB = CategoriesDB()
    itemToDelete._index = key

    dynamoDbObjectMapper.remove(itemToDelete, completionHandler:              
    {(error: Error?) -> Void in
        if let error = error {
            print(" Amazon DynamoDB Save Error: \(error)")
            return
        }
        print("A Category was deleted.")
    })
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311216 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO