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

Fix: mysql JSONSet Build bool type to 1/0,expected true/false #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sunbeam27
Copy link

问题描述

User Case Description

	set := datatypes.JSONSet("object")
	set.Set("test_bool", meta.TestBool)
       db.....Update("object", set)

执行后结果

 { "test_bool": 1}

修改

bool 类型直接构造为 SQL,而不是通过 statement AddVar 替换为占位符

只进行了 mysql 的测试

@sunbeam27
Copy link
Author

mysql 下,在使用 JSONSet 更新 bool 类型 json 字段时,字段会被更新为 0/1 而不是 true/false。不符合预期,并且会导致反序列化失败。

@sunbeam27 sunbeam27 changed the title Fix: mysql JSONSet Build bool type to true/false,not 1/0 Fix: mysql JSONSet Build bool type to 1/0,expected true/false Jan 23, 2025
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.

1 participant