-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Support JSON type #303
Open
Tigrov
wants to merge
22
commits into
master
Choose a base branch
from
refactor-expressions
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+305
−104
Open
Support JSON type #303
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7acf312
Support JSON type
Tigrov deab5f2
Fix tests
Tigrov d99a183
Fix tests
Tigrov cf3a231
Fix tests
Tigrov 2f96444
Improve and fix tests
Tigrov d63f93a
Apply fixes from StyleCI
StyleCIBot 3ad759f
Improve and fix tests
Tigrov ccc7fdb
Fix mutation test
Tigrov 7777f5f
Rename steps
Tigrov fe21217
Add line to CHANGELOG.md [skip ci]
Tigrov a007860
Fix tests
Tigrov 9236a11
Update tests
Tigrov 4dc1dbe
Skip test [skip ci]
Tigrov 6feaaea
Update tests settings
Tigrov a6178cc
Update tests
Tigrov b668650
Update test settings
Tigrov 874db5b
Update test settings
Tigrov 34ae4d7
Merge branch 'master' into refactor-expressions
Tigrov 5b0e1f3
Improve test coverage
Tigrov 45a2db2
Update tests
Tigrov ac4429a
Revert build
Tigrov a428d2e
Merge branch 'master' into refactor-expressions
Tigrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Db\Oracle\Column; | ||
|
||
use Yiisoft\Db\Schema\Column\AbstractJsonColumn; | ||
|
||
use function is_resource; | ||
use function is_string; | ||
use function json_decode; | ||
use function stream_get_contents; | ||
|
||
use const JSON_THROW_ON_ERROR; | ||
|
||
/** | ||
* Represents a json column with eager parsing values retrieved from the database. | ||
*/ | ||
final class JsonColumn extends AbstractJsonColumn | ||
{ | ||
/** | ||
* @throws \JsonException | ||
*/ | ||
public function phpTypecast(mixed $value): mixed | ||
{ | ||
if (is_string($value)) { | ||
return json_decode($value, true, 512, JSON_THROW_ON_ERROR); | ||
} | ||
|
||
if (is_resource($value)) { | ||
return json_decode(stream_get_contents($value), true, 512, JSON_THROW_ON_ERROR); | ||
} | ||
|
||
return $value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.