-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaggs-tree-not-injectable.go
64 lines (51 loc) · 1.61 KB
/
aggs-tree-not-injectable.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package aggretastic
import (
"fmt"
"github.com/olivere/elastic/v7"
)
type notInjectable struct {
root elastic.Aggregation
}
func newNotInjectable(root elastic.Aggregation) *notInjectable {
return ¬Injectable{root: root}
}
func IsNotInjectable(agg Aggregation) bool {
_, ok := agg.(*notInjectable)
return ok
}
func (a *notInjectable) ExtractLeafPaths() (leafs [][]string) {
return make([][]string, 0)
}
func (a *notInjectable) Inject(subAggregation Aggregation, path ...string) (resultPaths [][]string, err error) {
err = ErrAggIsNotInjectable
return
}
func (a *notInjectable) InjectX(subAggregation Aggregation, path ...string) (resultPaths [][]string, err error) {
err = ErrAggIsNotInjectable
return
}
func (a *notInjectable) InjectSafe(subAggregation Aggregation, path ...string) (resultPaths [][]string, err error) {
err = ErrAggIsNotInjectable
return
}
func (a *notInjectable) GetAllSubs() map[string]Aggregation {
return nil
}
func (a *notInjectable) Select(path ...string) Aggregation {
// nothing to select because of no subAggregations
s, _ := a.root.Source()
fmt.Printf("notInjectable.Select() is ignored. The aggregation doesn't allow to have subAggregations. Root: %s", s)
return nil
}
func (a *notInjectable) Pop(path ...string) Aggregation {
// nothing to select because of no subAggregations
s, _ := a.root.Source()
fmt.Printf("notInjectable.Select() is ignored. The aggregation doesn't allow to have subAggregations. Root: %s", s)
return nil
}
func (a *notInjectable) Export() elastic.Aggregation {
return a.root
}
func (a *notInjectable) Source() (interface{}, error) {
return a.root.Source()
}