我为我的 ID 创建了一个自定义类型:type ID uintfunc (id ID) MarshalJSON() ([]byte, error) { e, _ := HashIDs.Encode([]int{int(id)}) fmt.Println(e) /// 34gj return []byte(e), nil}func (id *ID) Scan(value interface{}) error { *id = ID(value.(int64)) return nil}我使用 HashIDs 包对我的 ID 进行编码,以便用户无法在客户端读取它们。但我收到此错误:json:为类型 types.ID 调用 MarshalJSON 时出错:顶级值后的字符“g”无效
1 回答
- 1 回答
- 0 关注
- 133 浏览
添加回答
举报
0/150
提交
取消