Skip to content

Conversation

@dpanta94
Copy link
Member

@dpanta94 dpanta94 commented Sep 30, 2025

Introduces support for:

  • Binary Column Types (Binary & Varbinary)
  • Blob Column Types (tinyblob, blob, mediumblob, longblob)
  • Boolean Column Types (boolean, bit)
  • Primary keys for String and Binary Column Types.

Those were left behind during 3.0.0 release to avoid scope creep, but they are needed in TEC implementation so it seems wiser introducing them in the source rather than just inside TEC

Along with the tests for the above was able to identify and fix various bugs. and also updated the docs of the repo.

@dpanta94 dpanta94 self-assigned this Sep 30, 2025
@dpanta94 dpanta94 added the enhancement New feature or request label Sep 30, 2025
// Blob column with JSON PHP type
$columns[] = ( new Blob_Column( 'json_blob_data' ) )
->set_type( Column_Types::BLOB )
->set_php_type( PHP_Types::JSON );
Copy link
Contributor

Choose a reason for hiding this comment

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

I can think of an application of this in the KV-cache table, where the blob would be JSON, but the encode/decode would be done by the Packer: what is the API to define the encoder/decoder for a column?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you want to handle encoding, decoding yourself you specify PHP_Types::String. Then schema won't do any modification pre save or post retrieval.

If you specify PHP_Types::JSON => schema will json_encode before save and json_decode post retrieval.
If you specify PHP_Types::Blob => schema will base64_encode before save and base64_decode post retrieval.

Copy link
Member Author

Choose a reason for hiding this comment

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

In your use case, where you are handling encoding/decoding on your own, we would specify that the PHP type is string.

Copy link
Contributor

@lucatume lucatume left a comment

Choose a reason for hiding this comment

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

Comments should end in a full-stop (.) per CS rules.
Other that that, I've left a quetion about the API that is not blocking for this PR.

@dpanta94 dpanta94 requested a review from lucatume September 30, 2025 13:36
@dpanta94 dpanta94 merged commit fa9f3e8 into main Sep 30, 2025
2 checks passed
@dpanta94 dpanta94 deleted the feat/adding-more-column-types branch September 30, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants