@@ -23,11 +23,9 @@ void test_vector(pqxx::connection &conn) {
2323 assert (embedding.dimensions () == 3 );
2424 float arr[] = {4 , 5 , 6 };
2525 auto embedding2 = pgvector::Vector (arr, 3 );
26- tx.exec (" INSERT INTO items (embedding) VALUES ($1), ($2), ($3)" ,
27- {embedding, embedding2, std::nullopt });
26+ tx.exec (" INSERT INTO items (embedding) VALUES ($1), ($2), ($3)" , {embedding, embedding2, std::nullopt });
2827
29- pqxx::result res = tx.exec (
30- " SELECT embedding FROM items ORDER BY embedding <-> $1" , {embedding2});
28+ pqxx::result res = tx.exec (" SELECT embedding FROM items ORDER BY embedding <-> $1" , {embedding2});
3129 assert (res.size () == 3 );
3230 assert (res[0 ][0 ].as <pgvector::Vector>() == embedding2);
3331 assert (res[1 ][0 ].as <pgvector::Vector>() == embedding);
@@ -42,11 +40,9 @@ void test_halfvec(pqxx::connection &conn) {
4240 assert (embedding.dimensions () == 3 );
4341 float arr[] = {4 , 5 , 6 };
4442 auto embedding2 = pgvector::HalfVector (arr, 3 );
45- tx.exec (" INSERT INTO items (half_embedding) VALUES ($1), ($2), ($3)" ,
46- {embedding, embedding2, std::nullopt });
43+ tx.exec (" INSERT INTO items (half_embedding) VALUES ($1), ($2), ($3)" , {embedding, embedding2, std::nullopt });
4744
48- pqxx::result res = tx.exec (
49- " SELECT half_embedding FROM items ORDER BY half_embedding <-> $1" , {embedding2});
45+ pqxx::result res = tx.exec (" SELECT half_embedding FROM items ORDER BY half_embedding <-> $1" , {embedding2});
5046 assert (res.size () == 3 );
5147 assert (res[0 ][0 ].as <pgvector::HalfVector>() == embedding2);
5248 assert (res[1 ][0 ].as <pgvector::HalfVector>() == embedding);
@@ -59,11 +55,9 @@ void test_bit(pqxx::connection &conn) {
5955 pqxx::nontransaction tx (conn);
6056 auto embedding = " 101" ;
6157 auto embedding2 = " 111" ;
62- tx.exec (" INSERT INTO items (binary_embedding) VALUES ($1), ($2), ($3)" ,
63- {embedding, embedding2, std::nullopt });
58+ tx.exec (" INSERT INTO items (binary_embedding) VALUES ($1), ($2), ($3)" , {embedding, embedding2, std::nullopt });
6459
65- pqxx::result res = tx.exec (
66- " SELECT binary_embedding FROM items ORDER BY binary_embedding <~> $1" , pqxx::params{embedding2});
60+ pqxx::result res = tx.exec (" SELECT binary_embedding FROM items ORDER BY binary_embedding <~> $1" , pqxx::params{embedding2});
6761 assert (res.size () == 3 );
6862 assert (res[0 ][0 ].as <std::string>() == embedding2);
6963 assert (res[1 ][0 ].as <std::string>() == embedding);
@@ -76,11 +70,9 @@ void test_sparsevec(pqxx::connection &conn) {
7670 pqxx::nontransaction tx (conn);
7771 auto embedding = pgvector::SparseVector ({1 , 2 , 3 });
7872 auto embedding2 = pgvector::SparseVector ({4 , 5 , 6 });
79- tx.exec (" INSERT INTO items (sparse_embedding) VALUES ($1), ($2), ($3)" ,
80- {embedding, embedding2, std::nullopt });
73+ tx.exec (" INSERT INTO items (sparse_embedding) VALUES ($1), ($2), ($3)" , {embedding, embedding2, std::nullopt });
8174
82- pqxx::result res = tx.exec (
83- " SELECT sparse_embedding FROM items ORDER BY sparse_embedding <-> $1" , {embedding2});
75+ pqxx::result res = tx.exec (" SELECT sparse_embedding FROM items ORDER BY sparse_embedding <-> $1" , {embedding2});
8476 assert (res.size () == 3 );
8577 assert (res[0 ][0 ].as <std::string>() == " {1:4,2:5,3:6}/3" );
8678 assert (res[1 ][0 ].as <std::string>() == " {1:1,2:2,3:3}/3" );
0 commit comments