[英]PlanetScale: cannot unmarshal number into Go struct field
When I try to connect to my PlanetScale database using the CLI, I get a 'cannot unmarshal number into Go struct field' error.当我尝试使用 CLI 连接到我的 PlanetScale 数据库时,我收到“无法将数字编组到 Go 结构字段”错误。
CLI command to connect to db连接数据库的 CLI 命令
pscale connect <db_name> <branch_name> --port 3310
Error response错误响应
Error: json: cannot unmarshal number into Go struct field DatabaseBranch.dev of type bool
错误:json:无法将数字解组到 bool 类型的 Go 结构字段 DatabaseBranch.dev
Turns out this issue was caused because of a raw SQL insert that inputted 1 into a boolean field instead of true.原来这个问题是由于原始 SQL 插入将 1 输入到布尔字段而不是 true 引起的。 Running an SQL update command to replace the 1s with true solved the issue.
运行 SQL 更新命令将 1s 替换为 true 解决了该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.