Skip to content

Conversation

@bloeys
Copy link
Contributor

@bloeys bloeys commented Feb 24, 2025

Hi Raphael,

I have made a small addition that allows users to inject 'handlers' at runtime to add support for types that aren't handled by default. As an example of how this is used, I have made jai-pgvector, which adds support for the vector type from the popular pgvector extension, which we need in our company.

This should also make it very easy for others to add support for other types and other extensions, like PostGIS, for example. If you like, we can also use this ability to add some of the more popular types and extensions in Jaipg itself, as an on-demand feature (e.g. people who want pgvector call init_pgvector or similar).

Wish you a nice day 😊

Copy link
Owner

@rluba rluba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good! Do you have a sample implementation for any type that we could add to examples/example.jai to (a) document how it works and (b) use as a regression test?

return write_integer(col, name, info, slot, col_type, val);
}

case .UUID; #through; // UUIDs are simplye [16]u8, returned from postgres as a byte array
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove that comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was too obvious, but in retrospect perhaps not. I think you should keep the comment :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I readded the comment 👍🏻

@bloeys
Copy link
Contributor Author

bloeys commented Jul 14, 2025

Regarding a reference implementation, currently the only one I have is jai-pgvector, which is 1 file of ~130 lines. Perhaps we can add that as a module and use it in the example, and reference it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants