Skip to content

Commit

Permalink
gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
erictg committed Nov 10, 2019
1 parent 1ef5a58 commit 8834955
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func convertToValue(graphId int64, conf structDecoratorConfig, props map[string]
continue
}

mapKey := strings.Replace(k, fieldConfig.Name + ".", "", 1)
mapKey := strings.Replace(k, fieldConfig.Name+".", "", 1)

mapVal.SetMapIndex(reflect.ValueOf(mapKey), reflect.ValueOf(v))
}
Expand All @@ -525,7 +525,7 @@ func convertToValue(graphId int64, conf structDecoratorConfig, props map[string]

rawVal := reflect.ValueOf(raw)

if raw == nil || rawVal.IsZero(){
if raw == nil || rawVal.IsZero() {
continue //its already initialized to 0 value, no need to do anything
} else {
if fieldConfig.IsTime {
Expand Down
43 changes: 21 additions & 22 deletions decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ type tdString string
type tdInt int

type f struct {
Id int64 `gogm:"name=id"`
UUID string `gogm:"pk;name=uuid"`
Parents []*f `gogm:"direction=outgoing;relationship=test"`
Children []*f `gogm:"direction=incoming;relationship=test"`
Id int64 `gogm:"name=id"`
UUID string `gogm:"pk;name=uuid"`
Parents []*f `gogm:"direction=outgoing;relationship=test"`
Children []*f `gogm:"direction=incoming;relationship=test"`
}

type a struct {
Expand Down Expand Up @@ -253,21 +253,21 @@ func TestDecoder(t *testing.T) {
graph.Node{
Labels: []string{"f"},
Properties: map[string]interface{}{
"uuid": "0",
"uuid": "0",
},
NodeIdentity: 0,
},
graph.Node{
Labels: []string{"f"},
Properties: map[string]interface{}{
"uuid": "1",
"uuid": "1",
},
NodeIdentity: 1,
},
graph.Node{
Labels: []string{"f"},
Properties: map[string]interface{}{
"uuid": "2",
"uuid": "2",
},
NodeIdentity: 2,
},
Expand All @@ -282,24 +282,24 @@ func TestDecoder(t *testing.T) {
Type: "test",
},
},
Sequence: []int{1, 1, /*#*/ 2, 2},
Sequence: []int{1, 1 /*#*/, 2, 2},
},
},
}

f0 := f{
Id: 0,
UUID: "0",
Id: 0,
UUID: "0",
}

f1 := f{
Id: 1,
UUID: "1",
Id: 1,
UUID: "1",
}

f2 := f{
Id: 2,
UUID: "2",
Id: 2,
UUID: "2",
}

f0.Parents = []*f{&f1}
Expand Down Expand Up @@ -622,10 +622,10 @@ func TestDecoder(t *testing.T) {
NodeIdentity: 1,
Labels: []string{"propsTest"},
Properties: map[string]interface{}{
"uuid": var5uuid,
"props.test.test": "test",
"props.test2": "test2",
"props.test3": "test3",
"uuid": var5uuid,
"props.test.test": "test",
"props.test2": "test2",
"props.test3": "test3",
},
},
},
Expand All @@ -641,9 +641,9 @@ func TestDecoder(t *testing.T) {
Id: 1,
UUID: var5uuid,
Props: map[string]interface{}{
"test.test": "test",
"test2": "test2",
"test3": "test3",
"test.test": "test",
"test2": "test2",
"test3": "test3",
},
}

Expand Down Expand Up @@ -757,5 +757,4 @@ func TestDecoder(t *testing.T) {
req.Equal(int64(55), readin9.Id)
req.Equal("dasdfas", readin9.UUID)


}

0 comments on commit 8834955

Please sign in to comment.