Skip to content

Commit 5716efd

Browse files
committed
StructuredQueries Bool binding support
- [ ] Update package when this is merged: pointfreeco/swift-structured-queries#164
1 parent d84ca0d commit 5716efd

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let package = Package(
3939
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.5.0"),
4040
.package(url: "https://github.com/pointfreeco/swift-sharing", from: "2.3.0"),
4141
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"),
42-
.package(url: "https://github.com/pointfreeco/swift-structured-queries", from: "0.16.0"),
42+
.package(url: "https://github.com/pointfreeco/swift-structured-queries", branch: "bool-query-bindings"),
4343
],
4444
targets: [
4545
.target(

Sources/StructuredQueriesGRDBCore/CustomFunctions.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ extension QueryBinding {
100100
switch self {
101101
case .blob(let value):
102102
sqlite3_result_blob(db, Array(value), Int32(value.count), SQLITE_TRANSIENT)
103+
case .bool(let value):
104+
sqlite3_result_int64(db, value ? 1 : 0)
103105
case .double(let value):
104106
sqlite3_result_double(db, value)
105107
case .date(let value):

Sources/StructuredQueriesGRDBCore/QueryCursor.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ extension QueryBinding {
150150
switch self {
151151
case let .blob(blob):
152152
return Data(blob).databaseValue
153+
case let .bool(bool):
154+
return (bool ? 1 : 0).databaseValue
153155
case let .date(date):
154156
return date.iso8601String.databaseValue
155157
case let .double(double):

0 commit comments

Comments
 (0)