Skip to content

Commit

Permalink
Added test for binary copy
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Mar 6, 2024
1 parent ada5859 commit 377a419
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Pgvector.CSharp.Tests/NpgsqlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ public async Task Main()
await cmd.ExecuteNonQueryAsync();
}

await using (var writer = conn.BeginBinaryImport("COPY items (embedding) FROM STDIN WITH (FORMAT BINARY)"))
{
writer.StartRow();
writer.Write(new Vector(new float[] { 1, 1, 1 }));

writer.StartRow();
writer.Write(new Vector(new float[] { 2, 2, 2 }));

writer.StartRow();
writer.Write(new Vector(new float[] { 1, 1, 2 }));

writer.Complete();
}

await using (var cmd = new NpgsqlCommand("SELECT $1", conn))
{
var embedding = new Vector(new float[16000]);
Expand Down

0 comments on commit 377a419

Please sign in to comment.