Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 4cba802

Browse files
Update to swift 5.2.1 (#40)
* Update to swift 5.2.1 * Fix PostgreSQLDemo * Fix PostgreSQLDemo with column result * Fix PostgreSQLDemo outfile.json
1 parent c88b0c2 commit 4cba802

File tree

13 files changed

+93
-19
lines changed

13 files changed

+93
-19
lines changed

Examples/HTTPSRequest/.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nio-swift:5.1.5
1+
FROM nio-swift:5.2.1
22

33
# Or your actual UID, GID on Linux if not the default 1000
44
ARG USERNAME=vscode

Examples/HTTPSRequest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HTTPSRequest
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an HTTPS request.
66

Examples/HelloWorld/.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM nio-swift:5.1.5
1+
FROM nio-swift:5.2.1
22

33
# Or your actual UID, GID on Linux if not the default 1000
44
ARG USERNAME=vscode

Examples/HelloWorld/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HelloWorld
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework to build a simple lambda.
66

Examples/PostgreSQLDemo/Package.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import PackageDescription
55

66
let package = Package(
77
name: "PostgreSQLDemo",
8+
platforms: [
9+
.macOS(.v10_15)
10+
],
811
dependencies: [
912
// Dependencies declare other packages that this package depends on.
1013
// .package(url: /* package url */, from: "1.0.0"),
1114
.package(url: "https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin", from: "1.0.0"),
12-
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.0.0-alpha.1.6"),
15+
.package(url: "https://github.com/vapor/postgres-nio.git", from: "1.0.0-rc.2"),
1316
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
1417
],
1518
targets: [

Examples/PostgreSQLDemo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PostgreSQLDemo
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an Postgres query using
66
[PostgresNIO](https://github.com/vapor/postgres-nio.git).

Examples/PostgreSQLDemo/Sources/PostgreSQLDemo/main.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ do {
5959

6060
let syncCodableNIOLambda: SyncCodableNIOLambda<Event, Response> = { (event, context) throws -> EventLoopFuture<Response> in
6161

62-
let future = connection.query(event.query).map { (rows) -> Response in
63-
return Response(value: "\(rows)")
62+
let future = connection.query(event.query).map { (result) -> Response in
63+
64+
guard let value = result.rows[0].column("result")?.string else {
65+
return Response(value: "")
66+
}
67+
return Response(value: "\(value)")
6468

6569
}
6670
return future

Examples/PostgreSQLDemo/outfile.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"value":"[[\"result\": 2]]"}
1+
{"value":"2"}

Examples/RedisDemo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RedisDemo
22

3-
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/)
3+
[![Swift 5](https://img.shields.io/badge/Swift-5.0-blue.svg)](https://swift.org/download/) [![Swift 5.1.5](https://img.shields.io/badge/Swift-5.1.5-blue.svg)](https://swift.org/download/) [![Swift 5.2.1](https://img.shields.io/badge/Swift-5.2.1-blue.svg)](https://swift.org/download/)
44

55
This example shows the usage of the [LambdaSwiftSprinter](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-core) framework and the plugin [LambdaSwiftSprinterNioPlugin](https://github.com/swift-sprinter/aws-lambda-swift-sprinter-nio-plugin) to build a lambda capable to perform an Redis request using
66
[RediStack](https://gitlab.com/mordil/swift-redi-stack.git).

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
# Use this tag to build a customized local image
33

4-
SWIFT_VERSION?=5.1.5
5-
LAYER_VERSION?=5-1-5
6-
# SWIFT_VERSION=5.0.3
7-
# LAYER_VERSION=5-0-3
4+
SWIFT_VERSION?=5.2.1
5+
LAYER_VERSION?=5-2-1
6+
# SWIFT_VERSION=5.1.5
7+
# LAYER_VERSION=5-1-5
88
DOCKER_TAG=nio-swift:$(SWIFT_VERSION)
99
SWIFT_DOCKER_IMAGE=$(DOCKER_TAG)
1010
SWIFT_LAMBDA_LIBRARY=nio-swift-lambda-runtime-$(LAYER_VERSION)
@@ -109,7 +109,7 @@ extract_libraries:
109109
--volume "$(MOUNT_ROOT)/:/src" \
110110
--workdir "/src/$(DOCKER_PROJECT_PATH)" \
111111
$(SWIFT_DOCKER_IMAGE) \
112-
/bin/bash -c "ldd .build/$(SWIFT_CONFIGURATION)/$(SWIFT_EXECUTABLE) | grep so | sed -e '/^[^\t]/ d' | sed -e 's/\t//' | sed -e 's/(0.*)//'"
112+
/bin/bash -c "ldd .build/$(SWIFT_CONFIGURATION)/$(SWIFT_EXECUTABLE) | grep so | sed -e '/^[^\t]/ d' | sed -e 's/\t//' | sed -e 's/(0.*)//' | sort"
113113

114114
build_lambda:
115115
docker run \
@@ -123,7 +123,7 @@ test_package:
123123
docker run \
124124
--rm \
125125
--volume "$(MOUNT_ROOT)/:/src" \
126-
--workdir "/src/" \
126+
--workdir "/src/$(DOCKER_PROJECT_PATH)" \
127127
$(SWIFT_DOCKER_IMAGE) \
128128
swift test
129129

0 commit comments

Comments
 (0)