Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not generate bson:"_id, omitempty" #3

Closed
bingochen87 opened this issue Apr 15, 2019 · 1 comment
Closed

Not generate bson:"_id, omitempty" #3

bingochen87 opened this issue Apr 15, 2019 · 1 comment

Comments

@bingochen87
Copy link

Use example code to regenerate data.pb.go, but not generate bson:"_id, omitempty" or other tag "bson:xxxxx" fields.

Code fragment:

package main

import (
	fmt "fmt"
	pmongo "github.com/amsokol/mongo-go-driver-protobuf/pmongo"
	_ "github.com/amsokol/protoc-gen-gotag/tagger"
	proto "github.com/golang/protobuf/proto"
	timestamp "github.com/golang/protobuf/ptypes/timestamp"
	wrappers "github.com/golang/protobuf/ptypes/wrappers"
	math "math"
)

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package

type Data struct {
	Id                   *pmongo.ObjectId      `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	BoolValue            bool                  `protobuf:"varint,2,opt,name=boolValue,proto3" json:"boolValue,omitempty"`
	BoolProtoValue       *wrappers.BoolValue   `protobuf:"bytes,3,opt,name=boolProtoValue,proto3" json:"boolProtoValue,omitempty"`
	BytesValue           []byte                `protobuf:"bytes,4,opt,name=bytesValue,proto3" json:"bytesValue,omitempty"`
	BytesProtoValue      *wrappers.BytesValue  `protobuf:"bytes,5,opt,name=bytesProtoValue,proto3" json:"bytesProtoValue,omitempty"`
	DoubleValue          float64               `protobuf:"fixed64,6,opt,name=doubleValue,proto3" json:"doubleValue,omitempty"`
	DoubleProtoValue     *wrappers.DoubleValue `protobuf:"bytes,7,opt,name=doubleProtoValue,proto3" json:"doubleProtoValue,omitempty"`
	FloatValue           float32               `protobuf:"fixed32,8,opt,name=floatValue,proto3" json:"floatValue,omitempty"`
	FloatProtoValue      *wrappers.FloatValue  `protobuf:"bytes,9,opt,name=floatProtoValue,proto3" json:"floatProtoValue,omitempty"`
	Int32Value           int32                 `protobuf:"varint,10,opt,name=int32Value,proto3" json:"int32Value,omitempty"`
	Int32ProtoValue      *wrappers.Int32Value  `protobuf:"bytes,11,opt,name=int32ProtoValue,proto3" json:"int32ProtoValue,omitempty"`
	Int64Value           int64                 `protobuf:"varint,12,opt,name=int64Value,proto3" json:"int64Value,omitempty"`
	Int64ProtoValue      *wrappers.Int64Value  `protobuf:"bytes,13,opt,name=int64ProtoValue,proto3" json:"int64ProtoValue,omitempty"`
	StringValue          string                `protobuf:"bytes,14,opt,name=stringValue,proto3" json:"stringValue,omitempty"`
	StringProtoValue     *wrappers.StringValue `protobuf:"bytes,15,opt,name=stringProtoValue,proto3" json:"stringProtoValue,omitempty"`
	Uint32Value          uint32                `protobuf:"varint,16,opt,name=uint32Value,proto3" json:"uint32Value,omitempty"`
	Uint32ProtoValue     *wrappers.UInt32Value `protobuf:"bytes,17,opt,name=uint32ProtoValue,proto3" json:"uint32ProtoValue,omitempty"`
	Uint64Value          uint64                `protobuf:"varint,18,opt,name=uint64Value,proto3" json:"uint64Value,omitempty"`
	Uint64ProtoValue     *wrappers.UInt64Value `protobuf:"bytes,19,opt,name=uint64ProtoValue,proto3" json:"uint64ProtoValue,omitempty"`
	Timestamp            *timestamp.Timestamp  `protobuf:"bytes,20,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	XXX_NoUnkeyedLiteral struct{}              `json:"-"`
	XXX_unrecognized     []byte                `json:"-"`
	XXX_sizecache        int32                 `json:"-"`
}
@bingochen87
Copy link
Author

Sorry for that, I don't use the second command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant