Skip to content

Commit

Permalink
configurable struct namespace separator (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
alxfv authored Jul 8, 2021
1 parent e56bbb1 commit 1a71822
Show file tree
Hide file tree
Showing 8 changed files with 690 additions and 235 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ _testmain.go
*.test
*.prof
old.txt
new.txt
new.txt

/.idea
3 changes: 2 additions & 1 deletion decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ func (d *decoder) traverseStruct(v reflect.Value, typ reflect.Type, namespace []
if first {
namespace = append(namespace, f.name...)
} else {
namespace = append(namespace, namespaceSeparator)
namespace = append(namespace, d.d.namespacePrefix...)
namespace = append(namespace, f.name...)
namespace = append(namespace, d.d.namespaceSuffix...)
}

if d.setFieldByType(v.Field(f.idx), namespace, 0) {
Expand Down
Loading

0 comments on commit 1a71822

Please sign in to comment.