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

jsonb location update and infoj #1270

Merged
merged 5 commits into from
May 21, 2024
Merged

Conversation

dbauszus-glx
Copy link
Member

@dbauszus-glx dbauszus-glx commented May 21, 2024

By defining a jsonb_field and jsonb_key it should be possible to update the a key value in a json field by casting the new key value.

The fieldfx can retrieve a single value.

The field must be unique for lookup of the value returned.

{
  "title": "Age",
  "field": "json_field_age",
  "fieldfx": "json_field -> 'age'",
  "jsonb_field": "json_field",
  "jsonb_key": "age",
  "edit": true,
  "inline": true
}

The location update will create a jsonb object with the field, key, and value to update.

The location_update query can create a coalesce update statement for the field.

The infoj must transform the value object from the newValue object into a simple value.

@AlexanderGeere
Copy link
Contributor

AlexanderGeere commented May 21, 2024

@dbauszus-glx I changed it slightly to allow you to update multiple keys in the field at once. Works in the infoj and in the table for me in this state.

Copy link

sonarcloud bot commented May 21, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@dbauszus-glx dbauszus-glx merged commit d2b89ce into GEOLYTIX:main May 21, 2024
5 checks passed
@RobAndrewHurst RobAndrewHurst added the Code Issues related to the code structure and performance. label May 23, 2024
@dbauszus-glx dbauszus-glx deleted the jsonb-update branch September 9, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Issues related to the code structure and performance.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants