-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/adding more column types #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…umns as primary keys
| // Blob column with JSON PHP type | ||
| $columns[] = ( new Blob_Column( 'json_blob_data' ) ) | ||
| ->set_type( Column_Types::BLOB ) | ||
| ->set_php_type( PHP_Types::JSON ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
lucatume
left a comment
There was a problem hiding this 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.
Introduces support for:
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.