Skip to content

Commit 0d09492

Browse files
committed
Improved code
1 parent f1d8f8d commit 0d09492

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

Sources/PgvectorNIO/HalfVector.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import Pgvector
22
import PostgresNIO
33

4-
extension HalfVector: @retroactive PostgresEncodable {
5-
public static var psqlType: PostgresDataType = PostgresDataType(1)
4+
extension HalfVector: @retroactive PostgresDynamicTypeEncodable {
5+
public static var psqlType: PostgresDataType?
66

7-
public static var psqlFormat: PostgresFormat {
7+
public var psqlType: PostgresDataType {
8+
HalfVector.psqlType!
9+
}
10+
11+
public var psqlFormat: PostgresFormat {
812
.binary
913
}
1014

Sources/PgvectorNIO/SparseVector.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import Pgvector
22
import PostgresNIO
33

4-
extension SparseVector: @retroactive PostgresEncodable {
5-
public static var psqlType: PostgresDataType = PostgresDataType(1)
4+
extension SparseVector: @retroactive PostgresDynamicTypeEncodable {
5+
public static var psqlType: PostgresDataType?
66

7-
public static var psqlFormat: PostgresFormat {
7+
public var psqlType: PostgresDataType {
8+
SparseVector.psqlType!
9+
}
10+
11+
public var psqlFormat: PostgresFormat {
812
.binary
913
}
1014

Sources/PgvectorNIO/Vector.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import Pgvector
22
import PostgresNIO
33

4-
extension Vector: @retroactive PostgresEncodable {
5-
public static var psqlType: PostgresDataType = PostgresDataType(1)
4+
extension Vector: @retroactive PostgresDynamicTypeEncodable {
5+
public static var psqlType: PostgresDataType?
66

7-
public static var psqlFormat: PostgresFormat {
7+
public var psqlType: PostgresDataType {
8+
Vector.psqlType!
9+
}
10+
11+
public var psqlFormat: PostgresFormat {
812
.binary
913
}
1014

0 commit comments

Comments
 (0)