Update AWSSDKSwift and remove non-throwing try statements

This commit is contained in:
Joe Smith 2019-10-14 21:20:42 -07:00
parent 0fa612aff0
commit 071e24d3d7
3 changed files with 13 additions and 16 deletions

View File

@ -6,17 +6,17 @@
"repositoryURL": "https://github.com/swift-aws/aws-sdk-swift",
"state": {
"branch": null,
"revision": "ed9cba4149087e19569d470867c73eff4b7ef552",
"version": "3.2.0"
"revision": "028a16332df2212f82dc64ada4568131844a9e47",
"version": "3.3.0"
}
},
{
"package": "AWSSDKSwiftCore",
"repositoryURL": "https://github.com/swift-aws/aws-sdk-swift-core",
"state": {
"branch": "yasumoto-5.1",
"revision": "516c1df2d523406ff3234334d924f7149a242e2e",
"version": null
"branch": null,
"revision": "14dc7e963b9889c57395cb280f634540da189501",
"version": "3.4.0"
}
},
{
@ -51,8 +51,8 @@
"repositoryURL": "https://github.com/vapor/fluent",
"state": {
"branch": null,
"revision": "b915c321c6f9e83743ee5efa35a30895e1b02e51",
"version": "3.2.0"
"revision": "783819d8838d15e1a05b459aa0fd1bde1e37ac26",
"version": "3.2.1"
}
},
{

View File

@ -14,10 +14,7 @@ let package = Package(
.package(url: "https://github.com/vapor/fluent", from: "3.1.0"),
// 💫 AWS Client Library
.package(url: "https://github.com/swift-aws/aws-sdk-swift", from: "3.2.0"),
// 💫 AWS Client Library
.package(url: "https://github.com/swift-aws/aws-sdk-swift-core", .branch("yasumoto-5.1")),
.package(url: "https://github.com/swift-aws/aws-sdk-swift", from: "3.3.0"),
],
targets: [
.target(

View File

@ -77,18 +77,18 @@ extension DynamoConnection: DatabaseQueryable {
case .get:
let inputItem = DynamoDB.GetItemInput(
key: requestedKey, tableName: query.table)
return try self.handle.getItem(inputItem).map { output in
return self.handle.getItem(inputItem).map { output in
return try handler(Output(attributes: output.item))
}
case .set:
let inputItem = DynamoDB.PutItemInput(item: requestedKey, returnValues: .allOld, tableName: query.table)
return try self.handle.putItem(inputItem).map { output in
return self.handle.putItem(inputItem).map { output in
return try handler(Output(attributes: output.attributes))
}
case .delete:
let inputItem = DynamoDB.DeleteItemInput(
key: requestedKey, returnValues: .allOld, tableName: query.table)
return try self.handle.deleteItem(inputItem).map { output in
return self.handle.deleteItem(inputItem).map { output in
return try handler(DynamoValue(attributes: output.attributes))
}
case .filter:
@ -129,7 +129,7 @@ extension DynamoConnection: DatabaseQueryable {
// Note that DynamoDB allows batch operations to query multiple items. For simplicity, we're
// always assuming we're querying one table at a time. We will always check the response for
// the table name we've specified in the query itself.
return try self.handle.batchGetItem(batchInput).map { (output: DynamoDB.BatchGetItemOutput) -> [DynamoValue] in
return self.handle.batchGetItem(batchInput).map { (output: DynamoDB.BatchGetItemOutput) -> [DynamoValue] in
guard let values: [[String : DynamoDB.AttributeValue]] = output.responses?[query.table] else { return [DynamoValue]() }
return values.map { DynamoValue(attributes: $0) }
}
@ -145,7 +145,7 @@ extension DynamoConnection: DatabaseQueryable {
indexName: query.index,
keyConditionExpression: query.keyConditionExpression,
tableName: query.table)
return try self.handle.query(queryInput).map { (output: DynamoDB.QueryOutput) in
return self.handle.query(queryInput).map { (output: DynamoDB.QueryOutput) in
return output.items?.compactMap { (item: [String: DynamoDB.AttributeValue]) -> DynamoValue in
return DynamoValue(attributes: item)
} ?? [DynamoValue]()