go语言网站开发教程,yii2框架做的网站有哪些,免费网络推广的方法,百度导航下载2020新版语音使用方法
err : bp.data.redis.Get(ctx, policyKey).Scan(result)起初在 redis 5.x.x 版本并没有遇到错误#xff0c;但是在切换 redis 实例之后就出现了错误#xff08;他们之间只是版本不同#xff09;。 修复方法 看错误日志的描述#xff0c;大概含义就是需要我们…使用方法
err : bp.data.redis.Get(ctx, policyKey).Scan(result)起初在 redis 5.x.x 版本并没有遇到错误但是在切换 redis 实例之后就出现了错误他们之间只是版本不同。 修复方法 看错误日志的描述大概含义就是需要我们自己手动实现一个 json 的序列化。
类似下面这样即可修复。
type MyStruct struct{}
func (m *MyStruct) MarshalBinary() ([]byte, error) {return json.Marshal(m)
}相关参考: https://stackoverflow.com/questions/60925203/cant-marshal-implement-encoding-binarymarshaler-go-redis-sdd-with-multiple 文中描述了数组的实现方式就是需要自己封装一下数组类似 type MyStructArray []MyStruct 然后 func (m *MyStructArray) MarshalBinary() 即可。