Skip to content

Commit 106addc

Browse files
committed
add PostgreSQLBoolLiteral
1 parent 388ca50 commit 106addc

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
public enum PostgreSQLBoolLiteral: SQLBoolLiteral {
2+
/// See `SQLBoolLiteral`.
3+
public static var `true`: PostgreSQLBoolLiteral {
4+
return ._true
5+
}
6+
7+
/// See `SQLBoolLiteral`.
8+
public static var `false`: PostgreSQLBoolLiteral {
9+
return ._false
10+
}
11+
12+
case _true
13+
case _false
14+
15+
/// See `SQLSerializable`.
16+
public func serialize(_ binds: inout [Encodable]) -> String {
17+
switch self {
18+
case ._true: return "TRUE"
19+
case ._false: return "FALSE"
20+
}
21+
}
22+
}

Sources/PostgreSQL/SQL/PostgreSQLGeneric.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public typealias PostgreSQLJoin = GenericSQLJoin<
7373
public typealias PostgreSQLJoinMethod = GenericSQLJoinMethod
7474

7575
/// See `SQLQuery`.
76-
public typealias PostgreSQLLiteral = GenericSQLLiteral<PostgreSQLDefaultLiteral>
76+
public typealias PostgreSQLLiteral = GenericSQLLiteral<PostgreSQLDefaultLiteral, PostgreSQLBoolLiteral>
7777

7878
/// See `SQLQuery`.
7979
public typealias PostgreSQLOrderBy = GenericSQLOrderBy<PostgreSQLExpression, PostgreSQLDirection>

0 commit comments

Comments
 (0)