Skip to content

Commit 8324bf0

Browse files
committed
move to UInt32 for oid
1 parent 6e20e6a commit 8324bf0

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
/Packages
44
/*.xcodeproj
55
Package.resolved
6+
DerivedData
67

Diff for: Sources/FluentPostgreSQL/PostgreSQLTableNameCache.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Async
33
/// Caches table OID to string name associations.
44
final class PostgreSQLTableNameCache {
55
/// The internal cache.
6-
var storage: [Int32: String]
6+
var storage: [UInt32: String]
77

88
/// Static shared cache, stored by connections.
99
private static var _shared: ThreadSpecificVariable<PostgreSQLTableNameCaches> = .init()
@@ -22,7 +22,7 @@ final class PostgreSQLTableNameCache {
2222
}
2323

2424
/// Creates a new cache.
25-
private init(_ cache: [Int32: String]) {
25+
private init(_ cache: [UInt32: String]) {
2626
self.storage = cache
2727
}
2828

@@ -37,10 +37,10 @@ final class PostgreSQLTableNameCache {
3737
return Future.map(on: connection) { existing }
3838
} else {
3939
return connection.simpleQuery("select oid, relname from pg_class").map(to: PostgreSQLTableNameCache.self) { rows in
40-
var cache: [Int32: String] = [:]
40+
var cache: [UInt32: String] = [:]
4141

4242
for row in rows {
43-
let oid = try row.firstValue(forColumn: "oid")!.decode(Int32.self)
43+
let oid = try row.firstValue(forColumn: "oid")!.decode(UInt32.self)
4444
let name = try row.firstValue(forColumn: "relname")!.decode(String.self)
4545
cache[oid] = name
4646
}

0 commit comments

Comments
 (0)