8000 facades.DB() Support Updating JSON Columns · Issue #713 · goravel/goravel · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
facades.DB() Support Updating JSON Columns #713
@almas-x

Description

@almas-x

Before feedback (在反馈之前)

  • There are no features that I want to submit in Issues (当前 Issues 中没有我将要提交的新功能)

Describe Feature (描述功能)

When updating a JSON column, support use -> syntax to update the appropriate key in the JSON object.

facades.DB().Table("users").Where("id", 1).Update("options->enabled", true)
facades.DB().Table("users").Where("id", 1).Update("options->languages[0]", "en")
facades.DB().Table("users").Where("id", 1).Update("options->languages", []string{"en", "de"})

facades.DB().Table("users").Where("id", 1).Update(map[string]any{
    "preferences->dining->meal": "salad",
    "options->languages[0]":     "en",
    "options->enabled":          true,
})

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

📋 To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0