| 1 |
package typedecl |
| 2 |
|
| 3 |
import ( |
| 4 |
"encoding/json" |
| 5 |
|
| 6 |
"github.com/gogo/protobuf/jsonpb" |
| 7 |
) |
| 8 |
|
| 9 |
type Dropped struct { |
| 10 |
Name string |
| 11 |
Age int32 |
| 12 |
} |
| 13 |
|
| 14 |
func (d *Dropped) Drop() bool { |
| 15 |
return true |
| 16 |
} |
| 17 |
|
| 18 |
func (d *Dropped) UnmarshalJSONPB(u *jsonpb.Unmarshaler, b []byte) error { |
| 19 |
return json.Unmarshal(b, d) |
| 20 |
} |
| 21 |
|
| 22 |
func (d *Dropped) MarshalJSONPB(*jsonpb.Marshaler) ([]byte, error) { |
| 23 |
return json.Marshal(d) |
| 24 |
} |
| 25 |
|
| 26 |
type DroppedWithoutGetters struct { |
| 27 |
Width int64 |
| 28 |
Height int64 |
| 29 |
} |
| 30 |
|
| 31 |
func (d *DroppedWithoutGetters) GetHeight() int64 { |
| 32 |
return d.Height |
| 33 |
} |
| 34 |
|
| 35 |
func (d *DroppedWithoutGetters) UnmarshalJSONPB(u *jsonpb.Unmarshaler, b []byte) error { |
| 36 |
return json.Unmarshal(b, d) |
| 37 |
} |
| 38 |
|
| 39 |
func (d *DroppedWithoutGetters) MarshalJSONPB(*jsonpb.Marshaler) ([]byte, error) { |
| 40 |
return json.Marshal(d) |
| 41 |
} |