I define a test.proto:
message PlayerRegister {
string GameSvrId = 1;
}
Then generate a test.pb.go:
type PlayerRegister struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GameSvrId string `protobuf:"bytes,1,opt,name=GameSvrId,proto3" json:"GameSvrId,omitempty"`
}
In this case, when I use Gorm, the SQL is:
INSERT INTO `player_registers` (`game_svr_id`) VALUES ('1.0.0')
But I want the SQL is:
INSERT INTO `PlayerRegister` (`GameSvrId`) VALUES ('1.0.0')
I want table and field names are the same as defined in the test.proto, I know can add gorm:"column:GameSvrId" in struct, but how code in proto?
What should I do?