Skip to content

Commit 5e602c4

Browse files
authored
Apply standard formatting. (#17)
1 parent 47408ee commit 5e602c4

File tree

60 files changed

+3264
-3122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3264
-3122
lines changed

Diff for: .swiftformat

+1-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,7 @@
44
# file options
55
--exclude .build
66

7-
# rules
8-
97
# format options
10-
--ifdef no-indent
11-
--nospaceoperators ...,..<
12-
--self insert
138
--allman false
14-
15-
#--maxwidth 150
16-
--wraparguments after-first
17-
--wrapparameters after-first
18-
--wrapcollections after-first
199
--closingparen same-line
10+
--self insert

Diff for: Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+DynamoDBTableAsync.swift

+111-102
Large diffs are not rendered by default.

Diff for: Sources/DynamoDBTables/AWSDynamoDBCompositePrimaryKeyTable+deleteItems.swift

+16-17
Original file line numberDiff line numberDiff line change
@@ -24,64 +24,63 @@
2424
// DynamoDBTables
2525
//
2626

27-
import Foundation
2827
import AWSDynamoDB
28+
import Foundation
2929
import Logging
3030

3131
// BatchExecuteStatement has a maximum of 25 statements
3232
private let maximumUpdatesPerExecuteStatement = 25
3333

3434
/// DynamoDBTable conformance updateItems function
3535
public extension AWSDynamoDBCompositePrimaryKeyTable {
36-
37-
private func deleteChunkedItems<AttributesType>(_ keys: [CompositePrimaryKey<AttributesType>]) async throws {
36+
private func deleteChunkedItems(_ keys: [CompositePrimaryKey<some Any>]) async throws {
3837
// if there are no keys, there is nothing to update
3938
guard keys.count > 0 else {
4039
return
4140
}
42-
41+
4342
let statements = try keys.map { existingKey -> DynamoDBClientTypes.BatchStatementRequest in
4443
let statement = try getDeleteExpression(tableName: self.targetTableName,
4544
existingKey: existingKey)
46-
45+
4746
return DynamoDBClientTypes.BatchStatementRequest(consistentRead: true, statement: statement)
4847
}
49-
48+
5049
let executeInput = BatchExecuteStatementInput(statements: statements)
51-
50+
5251
let response = try await self.dynamodb.batchExecuteStatement(input: executeInput)
5352
try throwOnBatchExecuteStatementErrors(response: response)
5453
}
55-
56-
private func deleteChunkedItems<ItemType: DatabaseItem>(_ existingItems: [ItemType]) async throws {
54+
55+
private func deleteChunkedItems(_ existingItems: [some DatabaseItem]) async throws {
5756
// if there are no items, there is nothing to update
5857
guard existingItems.count > 0 else {
5958
return
6059
}
61-
60+
6261
let statements = try existingItems.map { existingItem -> DynamoDBClientTypes.BatchStatementRequest in
6362
let statement = try getDeleteExpression(tableName: self.targetTableName,
6463
existingItem: existingItem)
65-
64+
6665
return DynamoDBClientTypes.BatchStatementRequest(consistentRead: true, statement: statement)
6766
}
68-
67+
6968
let executeInput = BatchExecuteStatementInput(statements: statements)
70-
69+
7170
let response = try await self.dynamodb.batchExecuteStatement(input: executeInput)
7271
try throwOnBatchExecuteStatementErrors(response: response)
7372
}
74-
75-
func deleteItems<AttributesType>(forKeys keys: [CompositePrimaryKey<AttributesType>]) async throws {
73+
74+
func deleteItems(forKeys keys: [CompositePrimaryKey<some Any>]) async throws {
7675
// BatchExecuteStatement has a maximum of 25 statements
7776
// This function handles pagination internally.
7877
let chunkedKeys = keys.chunked(by: maximumUpdatesPerExecuteStatement)
7978
try await chunkedKeys.concurrentForEach { chunk in
8079
try await self.deleteChunkedItems(chunk)
8180
}
8281
}
83-
84-
func deleteItems<ItemType: DatabaseItem>(existingItems: [ItemType]) async throws {
82+
83+
func deleteItems(existingItems: [some DatabaseItem]) async throws {
8584
// BatchExecuteStatement has a maximum of 25 statements
8685
// This function handles pagination internally.
8786
let chunkedItems = existingItems.chunked(by: maximumUpdatesPerExecuteStatement)

0 commit comments

Comments
 (0)