pgvector 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +0 -2
- data/lib/pgvector/pg.rb +11 -0
- data/lib/pgvector/version.rb +1 -1
- data/lib/pgvector.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e1249b9ced41c051b06654cea7539a58e2816d794461788bec605eab464cca8
|
4
|
+
data.tar.gz: fc65c3c883a39cd1b63c804eaae65897c2a332836b5d91ba5cf5248dc660fb8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37957502d147a221b3678c373b648090de7f9101fa1199e1721ffc1ac0e04d99318935866f12295a160c2f1d1d7648e3103355865eb1625b11619b9e52981d6
|
7
|
+
data.tar.gz: abdb670ea89993a92982c3913b192c6fed4ac6329beb2c0f1abb5aef39ef47993198ecdcdd5431ea057b84aa3931a532a96f5e85d0ab8a6c4faec48a98fc74de
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -25,8 +25,6 @@ And follow the instructions for your database library:
|
|
25
25
|
Register the vector type with your connection
|
26
26
|
|
27
27
|
```ruby
|
28
|
-
require "pgvector/pg"
|
29
|
-
|
30
28
|
registry = PG::BasicTypeRegistry.new.define_default_types
|
31
29
|
Pgvector::PG.register_vector(registry)
|
32
30
|
conn.type_map_for_results = PG::BasicTypeMapForResults.new(conn, registry: registry)
|
data/lib/pgvector/pg.rb
CHANGED
@@ -4,6 +4,17 @@ module Pgvector
|
|
4
4
|
module PG
|
5
5
|
def self.register_vector(registry)
|
6
6
|
registry.register_type(0, "vector", nil, TextDecoder::Vector)
|
7
|
+
registry.register_type(1, "vector", nil, BinaryDecoder::Vector)
|
8
|
+
end
|
9
|
+
|
10
|
+
module BinaryDecoder
|
11
|
+
class Vector < ::PG::SimpleDecoder
|
12
|
+
def decode(string, tuple = nil, field = nil)
|
13
|
+
dim, unused = string[0, 4].unpack("nn")
|
14
|
+
raise "expected unused to be 0" if unused != 0
|
15
|
+
string[4..-1].unpack("g#{dim}")
|
16
|
+
end
|
17
|
+
end
|
7
18
|
end
|
8
19
|
|
9
20
|
module TextDecoder
|
data/lib/pgvector/version.rb
CHANGED
data/lib/pgvector.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pgvector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: andrew@ankane.org
|