Skip to content

feat: implement CompileJsonColumnsUpdate#53

Merged
almas-x merged 2 commits intomasterfrom
almas/json-columns-update
Jun 26, 2025
Merged

feat: implement CompileJsonColumnsUpdate#53
almas-x merged 2 commits intomasterfrom
almas/json-columns-update

Conversation

@almas-x
Copy link
Contributor

@almas-x almas-x commented Jun 25, 2025

📑 Description

Resolve goravel/goravel#712
Resolve goravel/goravel#713
Related goravel/framework#1092

✅ Checks

  • Added test cases for my code

Copilot AI review requested due to automatic review settings June 25, 2025 09:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for compiling JSON column updates via a new CompileJsonColumnsUpdate method, resolving issues #712 and #713.

  • Imports the database helper alias and integrates it into JSON update expressions
  • Implements CompileJsonColumnsUpdate to transform JSON path update keys into jsonb_set calls
  • Returns a map of compiled assignments or an error
Comments suppressed due to low confidence (3)

grammar.go:303

  • [nitpick] Add a doc comment above CompileJsonColumnsUpdate describing its purpose, parameters, and return values to improve readability and maintainability.
func (r *Grammar) CompileJsonColumnsUpdate(values map[string]any) (map[string]any, error) {

grammar.go:303

  • There are no tests covering CompileJsonColumnsUpdate. Please add unit tests to verify JSON-path update behavior and edge cases.
func (r *Grammar) CompileJsonColumnsUpdate(values map[string]any) (map[string]any, error) {

grammar.go:310

  • The strings package is used here but not imported; add import "strings" to the imports block to prevent a compile error.
		if strings.Contains(key, "->") {

@almas-x almas-x force-pushed the almas/json-columns-update branch from b2d5d7b to 176a903 Compare June 25, 2025 09:21
@almas-x almas-x changed the title feat: [#712,#713] implement CompileJsonColumnsUpdate to handle JSON column updates feat: implement CompileJsonColumnsUpdate Jun 25, 2025
@almas-x almas-x force-pushed the almas/json-columns-update branch from 176a903 to 4ce15a8 Compare June 25, 2025 09:23
@almas-x almas-x force-pushed the almas/json-columns-update branch from 4ce15a8 to ddb66f1 Compare June 25, 2025 09:26
@almas-x almas-x requested a review from hwbrzzl June 25, 2025 14:01
hwbrzzl
hwbrzzl previously approved these changes Jun 26, 2025
Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

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

Nice 👍

Copy link
Contributor

@hwbrzzl hwbrzzl left a comment

Choose a reason for hiding this comment

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

nice 👍

@almas-x almas-x merged commit aae7c8a into master Jun 26, 2025
5 checks passed
@almas-x almas-x deleted the almas/json-columns-update branch June 26, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

facades.DB() Support Updating JSON Columns facades.Orm().Query() Support Updating JSON Columns

3 participants