mirror of
https://github.com/gofiber/storage.git
synced 2025-10-07 09:31:44 +08:00
implement DeleteMany()
This commit is contained in:
@@ -36,6 +36,32 @@ func (s *Storage) DeleteBucket(bucket string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// DeleteMany entries by keys.
|
||||
func (s *Storage) DeleteMany(keys ...string) error {
|
||||
if len(keys) <= 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
var objects []types.ObjectIdentifier
|
||||
for _, k := range keys {
|
||||
objects = append(objects, types.ObjectIdentifier{
|
||||
Key: aws.String(k),
|
||||
})
|
||||
}
|
||||
|
||||
ctx, cancel := s.requestContext()
|
||||
defer cancel()
|
||||
|
||||
_, err := s.svc.DeleteObjects(ctx, &s3.DeleteObjectsInput{
|
||||
Bucket: &s.bucket,
|
||||
Delete: &types.Delete{
|
||||
Objects: objects,
|
||||
},
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// SetWithChecksum sets key with value and checksum.
|
||||
//
|
||||
// Currently 4 algorithms are supported:
|
||||
|
Reference in New Issue
Block a user