[x] Name your Pull Request title clearly, concisely, and prefixed with the name of the primarily affected package you changed according to Good commit messages (such as memory: add interfaces for X, Y or util: add whizzbang helpers).
[x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
[x] Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. Fixes #123).
[x] Describes the source of new concepts.
[x] References existing implementations as appropriate.
This PR updates the pgvector vector store to support connections from either pgx or pgxpool.
This introduces breaking changes.
Removed Close func.
Removed WithConnectionURL from options.
Require WithConn to be set.
A PGXConn interface was added that contains all the funcs needed by the vector store. These funcs are offered by both pgx.Conn and pgxpool.Pool. The only difference between the two is how they handle closing the connection. This is why Close was removed. Close could be kept but would require checking the connection type to make sure the connection was a pgx.Conn and then close it properly. I think the better move is to remove it since vector store doesn't need this functionality
This also removed WithConnectionURL because removing the Close func the vector store can't safely close the created connection anymore. I think the better move is just passing a connection to the vector store to use.
WithConn was updated to accept PGXConn and will error if not set.
If breaking changes aren't desired I can convert it back to the same and just have the close func check to make sure the conn is pgx.Conn when using the Close func.
PR Checklist
memory: add interfaces for X, Y
orutil: add whizzbang helpers
).Fixes #123
).golangci-lint
checks.This PR updates the pgvector vector store to support connections from either pgx or pgxpool.
This introduces breaking changes.
A PGXConn interface was added that contains all the funcs needed by the vector store. These funcs are offered by both pgx.Conn and pgxpool.Pool. The only difference between the two is how they handle closing the connection. This is why Close was removed. Close could be kept but would require checking the connection type to make sure the connection was a pgx.Conn and then close it properly. I think the better move is to remove it since vector store doesn't need this functionality
This also removed WithConnectionURL because removing the Close func the vector store can't safely close the created connection anymore. I think the better move is just passing a connection to the vector store to use.
WithConn was updated to accept PGXConn and will error if not set.
If breaking changes aren't desired I can convert it back to the same and just have the close func check to make sure the conn is pgx.Conn when using the Close func.