Skip to content

Commit 495db9b

Browse files
committed
codablekit updates
1 parent 9851c69 commit 495db9b

File tree

6 files changed

+6
-20
lines changed

6 files changed

+6
-20
lines changed

Diff for: Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let package = Package(
1818
.package(url: "https://github.com/vapor/postgresql.git", from: "1.0.0-rc.2"),
1919
],
2020
targets: [
21-
.target(name: "FluentPostgreSQL", dependencies: ["Async", "CodableKit", "Fluent", "FluentSQL", "PostgreSQL"]),
21+
.target(name: "FluentPostgreSQL", dependencies: ["Async", "Fluent", "FluentSQL", "PostgreSQL"]),
2222
.testTarget(name: "FluentPostgreSQLTests", dependencies: ["FluentBenchmark", "FluentPostgreSQL"]),
2323
]
2424
)

Diff for: Sources/FluentPostgreSQL/PostgreSQLDatabase+QuerySupporting.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Async
2-
import CodableKit
2+
import Core
33
import FluentSQL
4-
import Foundation
54

65
/// Adds ability to do basic Fluent queries using a `PostgreSQLDatabase`.
76
extension PostgreSQLDatabase: QuerySupporting, CustomSQLSupporting {

Diff for: Sources/FluentPostgreSQL/PostgreSQLModel.swift

-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ public protocol PostgreSQLModel: Model where Self.Database == PostgreSQLDatabase
44
}
55

66
extension PostgreSQLModel {
7-
/// See `Model.Database`
8-
public typealias Database = PostgreSQLDatabase
9-
10-
/// See `Model.ID`
11-
public typealias ID = Int
12-
137
/// See `Model.idKey`
148
public static var idKey: IDKey { return \.id }
159
}

Diff for: Sources/FluentPostgreSQL/PostgreSQLType.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import CodableKit
2-
import Foundation
1+
import Core
32

43
/// A type that is compatible with PostgreSQL schema and data.
54
public protocol PostgreSQLType:
@@ -16,7 +15,7 @@ public protocol PostgreSQLJSONType: PostgreSQLType, PostgreSQLJSONCustomConverti
1615
/// A type that is supports being represented as T[] in a PostgreSQL database.
1716
public protocol PostgreSQLArrayType: PostgreSQLType, PostgreSQLArrayCustomConvertible { }
1817

19-
public protocol PostgreSQLEnumType: PostgreSQLType, Codable, TupleKeyStringDecodable, RawRepresentable where Self.RawValue: PostgreSQLDataConvertible { }
18+
public protocol PostgreSQLEnumType: PostgreSQLType, Codable, RawRepresentable where Self.RawValue: PostgreSQLDataConvertible { }
2019

2120
/// MARK: Default Implementations
2221

Diff for: Sources/FluentPostgreSQL/PostgreSQLUUIDModel.swift

-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ public protocol PostgreSQLUUIDModel: Model where Self.Database == PostgreSQLData
66
}
77

88
extension PostgreSQLUUIDModel {
9-
/// See `Model.Database`
10-
public typealias Database = PostgreSQLDatabase
11-
12-
/// See `Model.ID`
13-
public typealias ID = UUID
14-
159
/// See `Model.idKey`
1610
public static var idKey: IDKey { return \.id }
1711
}

Diff for: Tests/FluentPostgreSQLTests/FluentPostgreSQLTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Core
33
import XCTest
44
import FluentBenchmark
55
import FluentPostgreSQL
6+
import Fluent
67
import Foundation
78

89
class FluentPostgreSQLTests: XCTestCase {
@@ -157,15 +158,14 @@ class FluentPostgreSQLTests: XCTestCase {
157158
}
158159
_ = try Allergy(id: 2).create(on: conn).wait()
159160
_ = try Allergy(id: 4).create(on: conn).wait()
160-
let stuff = try Allergy.query(on: conn).filter(\Allergy.id, in: [1, 2, 3]).all().wait()
161+
let stuff = try Allergy.query(on: conn).filter(\.id ~~ [1, 2, 3]).all().wait()
161162
XCTAssertEqual(stuff.count, 1)
162163
XCTAssertEqual(stuff.first?.id, 2)
163164
}
164165

165166
func testGH21() throws {
166167
/// - types
167168
enum PetType: Int, PostgreSQLEnumType {
168-
static let keyString: TupleMap = (.cat, .dog)
169169
case cat = 1
170170
case dog = 2
171171
}

0 commit comments

Comments
 (0)