Skip to content

Commit

Permalink
fix-range-primitives (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
EItanya authored Dec 1, 2020
1 parent 2656a8e commit b238255
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 78 deletions.
10 changes: 5 additions & 5 deletions templates/equal/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ type Value struct {
func (fns goSharedFuncs) render(field pgs.Field) (string, error) {
var tpl *template.Template

if field.Type().ProtoType().IsNumeric() ||
if field.Type().IsRepeated() {
return fns.renderRepeated(field)
} else if field.Type().IsMap() {
return fns.renderMap(field)
} else if field.Type().ProtoType().IsNumeric() ||
field.Type().ProtoType() == pgs.BoolT ||
field.Type().IsEnum() {

tpl = template.Must(fns.tpl.New("primitive").Parse(primitiveTmpl))
} else if field.Type().IsMap() {
return fns.renderMap(field)
} else if field.Type().IsRepeated() {
return fns.renderRepeated(field)
} else {
switch field.Type().ProtoType() {
case pgs.BytesT:
Expand Down
31 changes: 21 additions & 10 deletions tests/api/hello.pb.equal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 55 additions & 44 deletions tests/api/hello.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 19 additions & 14 deletions tests/api/hello.pb.hash.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions tests/api/hello.pb.merge.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion tests/api/hello.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ enum Test {
message Nested {
Simple simple = 1;

google.protobuf.Struct details = 5;

Test test = 2;

Empty empty = 3 [(extproto.sensitive) = true];

repeated string hello = 4;

google.protobuf.Struct details = 5;

Simple skipper = 6 [(extproto.skip_hashing) = true];

repeated Simple x = 7 [(extproto.sensitive) = true];
Expand All @@ -63,6 +64,8 @@ message Nested {
Empty empty_one_of = 11;
NestedEmpty nested_one_of = 12;
}

repeated uint64 repeated_primitive = 13;
}


Expand Down

0 comments on commit b238255

Please sign in to comment.