github.com/gogo/protobuf@v1.3.2/test/issue260/models.go (about) 1 package issue260 2 3 import ( 4 "encoding/json" 5 "time" 6 7 "github.com/gogo/protobuf/jsonpb" 8 ) 9 10 type Dropped struct { 11 Name string 12 Age int32 13 } 14 15 func (d *Dropped) UnmarshalJSONPB(u *jsonpb.Unmarshaler, b []byte) error { 16 return json.Unmarshal(b, d) 17 } 18 19 func (d *Dropped) MarshalJSONPB(*jsonpb.Marshaler) ([]byte, error) { 20 return json.Marshal(d) 21 } 22 23 func (d *Dropped) Drop() bool { 24 return true 25 } 26 27 type DroppedWithoutGetters struct { 28 Width int64 29 Height int64 30 Timestamp time.Time `protobuf:"bytes,3,opt,name=timestamp,stdtime" json:"timestamp"` 31 NullableTimestamp *time.Time `protobuf:"bytes,4,opt,name=nullable_timestamp,json=nullableTimestamp,stdtime" json:"nullable_timestamp,omitempty"` 32 } 33 34 func (d *DroppedWithoutGetters) UnmarshalJSONPB(u *jsonpb.Unmarshaler, b []byte) error { 35 return json.Unmarshal(b, d) 36 } 37 38 func (d *DroppedWithoutGetters) MarshalJSONPB(*jsonpb.Marshaler) ([]byte, error) { 39 return json.Marshal(d) 40 }