-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.1.0 (unreleased) | ||
|
||
- First release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#if canImport(PostgresClientKit) | ||
import PostgresClientKit | ||
#endif | ||
|
||
struct HalfVector: Equatable { | ||
var value: [Float16] | ||
|
||
init(_ value: [Float16]) { | ||
self.value = value | ||
} | ||
|
||
static func == (lhs: HalfVector, rhs: HalfVector) -> Bool { | ||
return lhs.value == rhs.value | ||
} | ||
} | ||
|
||
#if canImport(PostgresClientKit) | ||
extension HalfVector: PostgresValueConvertible { | ||
public var postgresValue: PostgresValue { | ||
return PostgresValue(String(describing: value)) | ||
} | ||
} | ||
#endif |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#if canImport(PostgresClientKit) | ||
import PostgresClientKit | ||
#endif | ||
|
||
struct Vector: Equatable { | ||
var value: [Float] | ||
|
||
init(_ value: [Float]) { | ||
self.value = value | ||
} | ||
|
||
static func == (lhs: Vector, rhs: Vector) -> Bool { | ||
return lhs.value == rhs.value | ||
} | ||
} | ||
|
||
#if canImport(PostgresClientKit) | ||
extension Vector: PostgresValueConvertible { | ||
public var postgresValue: PostgresValue { | ||
return PostgresValue(String(describing: value)) | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Foundation | ||
import Testing | ||
@testable import Pgvector | ||
|
||
final class HalfVectorTests { | ||
@Test func equatable() { | ||
let a = HalfVector([1, 2, 3]) | ||
let b = HalfVector([1, 2, 3]) | ||
let c = HalfVector([1, 2, 4]) | ||
#expect(a == a) | ||
#expect(a == b) | ||
#expect(a != c) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Foundation | ||
import Testing | ||
@testable import Pgvector | ||
|
||
final class VectorTests { | ||
@Test func equatable() { | ||
let a = Vector([1, 2, 3]) | ||
let b = Vector([1, 2, 3]) | ||
let c = Vector([1, 2, 4]) | ||
#expect(a == a) | ||
#expect(a == b) | ||
#expect(a != c) | ||
} | ||
} |