-
golang 断言:一个蛋疼的处理场景
2021-12-06 15:11没接触过 Redis,但如果 json 数据可以转化为 string 类型的话,那么可以试试
"github.com/tidwall/sjson"
这个包,核心语句只有一行sjson.Set(json, "address.#.url", "wtf.mp4")
。代码:
package main import "github.com/tidwall/sjson" const json = `{ "address": [ { "duration": 90, "ext": "{\"key\":\"val\"}", "format": "mp4", "url": "xxx.mp4" }, { "duration": 90, "ext": "{\"key\":\"val\"}", "format": "mp4", "url": "xxx.mp4" } ], "value": "web" }` func main() { value, _ := sjson.Set(json, "address.#.url", "wtf.mp4") println(value) }
输出:
{ "address": [ { "duration": 90, "ext": "{\"key\":\"val\"}", "format": "mp4", "url": "wtf.mp4" }, { "duration": 90, "ext": "{\"key\":\"val\"}", "format": "mp4", "url": "wtf.mp4" } ], "value": "web" }
-
1.4.7 安装完之后,一直卡在 finish booting,再也不动了。
2021-11-06 10:30我也一样 😭 ,但是在浏览器中访问
http://127.0.0.1:6806/
可以看到正常页面。