问题Message user是这样的message User { int32 uid = 1; string username = 2; string password = 3;
}生成的go代码是这样的:type User struct {
Uid int32 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"`
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}我直接用上述User存入MySQL会出错,因为XXX_NoUnkeyedLiteral这些字段不存在,有个解决的办法是我手动改这个生成的代码,忽略这些字段,但不知大家是怎么做的?
添加回答
举报
0/150
提交
取消