Skip to content
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

[5.2] Adding postgres specific operators for jsonb type #13161

Merged
merged 4 commits into from
Apr 18, 2016
Merged

[5.2] Adding postgres specific operators for jsonb type #13161

merged 4 commits into from
Apr 18, 2016

Conversation

melanholly
Copy link

I was trying the features of Postgresql 9.5 and foundout that Eloquent does not support a couple of operators. Here I am adding the operators:

Operator Right Operand Type
@> jsonb Does the left JSON value contain the right JSON path/value entries at the top level?
<@ jsonb Are the left JSON path/value entries contained at the top level within the right JSON value?
? text Does the string exist as a top-level key within the JSON value?
? text[]
?& text[] Do all of these array strings exist as top-level keys?
- text Delete key/value pair or string element from left operand. Key/value pairs are matched based on their key value.
- integer Delete the array element with specified index (Negative integers count from the end). Throws an error if top level container is not an array.
#- text[] Delete the field or element with specified path (for JSON arrays, negative integers count from the end)

Reference -> http://www.postgresql.org/docs/9.5/static/functions-json.html

@melanholly
Copy link
Author

I've fixed so errors but I can't understand how to fix the mockery tests problems. It seems that the mocked class does not have the method. I am missing something serious here.

@GrahamCampbell GrahamCampbell changed the title Adding postgre spesific operators for jsonb type. [5.2] Adding postgres specific operators for jsonb type Apr 14, 2016
@GrahamCampbell
Copy link
Member

Please update the tests, and add new tests to cover what you've added.

@melanholly
Copy link
Author

I've fixed the possible issues. I am not so sure about the testing but i should cover the basic concept of using the operators for postgres. If you have any ideas about the testing that I can implement, please share them so I can make this pull request better.

@taylorotwell taylorotwell merged commit 0932c66 into laravel:5.2 Apr 18, 2016
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.

3 participants