Skip to content

Commit e525f41

Browse files
committed
Cleanup unused code
1 parent 00daaec commit e525f41

File tree

3 files changed

+0
-53
lines changed

3 files changed

+0
-53
lines changed

tail_test.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -90,37 +90,6 @@ var _ = Describe("Tail", func() {
9090
})
9191
})
9292

93-
Context("Test HasKey", func() {
94-
It("validate functionality", func() {
95-
toTest := map[string]interface{}{
96-
"fish": map[string]interface{}{
97-
"dog": "cat",
98-
},
99-
"tree": nil,
100-
"yellow": map[string]interface{}{
101-
"red": nil,
102-
},
103-
}
104-
actual := HasKey("blub", toTest)
105-
Expect(actual).To(Equal(false))
106-
107-
actual = HasKey("fish", toTest)
108-
Expect(actual).To(Equal(true))
109-
110-
actual = HasKey("fish.dog", toTest)
111-
Expect(actual).To(Equal(true))
112-
113-
actual = HasKey("yellow", toTest)
114-
Expect(actual).To(Equal(true))
115-
116-
actual = HasKey("yellow.red", toTest)
117-
Expect(actual).To(Equal(true))
118-
119-
actual = HasKey("tree", toTest)
120-
Expect(actual).To(Equal(true))
121-
})
122-
})
123-
12493
Context("test GetValue", func() {
12594
It("will find the first value", func() {
12695
testReference := mgo.DBRef{

tracker.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func (c changeTracker) HandleUpdate(w Watch, command map[string]interface{}, sel
4848
}
4949

5050
updateQuery := BuildUpdateQuery(w, command)
51-
5251
if updateQuery == nil {
5352
return
5453
}
@@ -68,13 +67,11 @@ func (c changeTracker) HandleRemove(w Watch, command map[string]interface{}, sel
6867

6968
func (c changeTracker) HandleInsert(w Watch, command map[string]interface{}, originRef mgo.DBRef) {
7069
reference := GetValue(w.TriggerReference, command)
71-
7270
if reference == nil {
7371
return
7472
}
7573

7674
ref, ok := getReference(reference, originRef.Database)
77-
7875
if !ok {
7976
return
8077
}
@@ -92,7 +89,6 @@ func (c changeTracker) HandleInsert(w Watch, command map[string]interface{}, ori
9289
}
9390

9491
query := BuildInsertQuery(w, user)
95-
9692
if query == nil {
9793
return
9894
}

utils.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,3 @@ func GetValue(from string, ds interface{}) interface{} {
2222

2323
return data[from]
2424
}
25-
26-
//HasKey will return wether the key was found or not
27-
func HasKey(key string, ds interface{}) bool {
28-
data, ok := ds.(map[string]interface{})
29-
if !ok {
30-
return false
31-
}
32-
33-
if index := strings.Index(key, "."); index != -1 {
34-
return HasKey(key[index+1:], data[key[:index]])
35-
}
36-
37-
if _, ok := data[key]; ok {
38-
return true
39-
}
40-
41-
return false
42-
}

0 commit comments

Comments
 (0)