/
summary.go
133 lines (123 loc) · 5.17 KB
/
summary.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [https://neo4j.com]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package db
// Definitions of these should correspond to public API
type StatementType int
const (
StatementTypeUnknown StatementType = 0
StatementTypeRead StatementType = 1
StatementTypeReadWrite StatementType = 2
StatementTypeWrite StatementType = 3
StatementTypeSchemaWrite StatementType = 4
)
// Counter key names
const (
NodesCreated = "nodes-created"
NodesDeleted = "nodes-deleted"
RelationshipsCreated = "relationships-created"
RelationshipsDeleted = "relationships-deleted"
PropertiesSet = "properties-set"
LabelsAdded = "labels-added"
LabelsRemoved = "labels-removed"
IndexesAdded = "indexes-added"
IndexesRemoved = "indexes-removed"
ConstraintsAdded = "constraints-added"
ConstraintsRemoved = "constraints-removed"
SystemUpdates = "system-updates"
)
// Plan describes the actual plan that the database planner produced and used (or will use) to execute your statement.
// This can be extremely helpful in understanding what a statement is doing, and how to optimize it. For more details,
// see the Neo4j Manual. The plan for the statement is a tree of plans - each sub-tree containing zero or more child
// plans. The statement starts with the root plan. Each sub-plan is of a specific operator, which describes what
// that part of the plan does - for instance, perform an index lookup or filter results.
// The Neo4j Manual contains a reference of the available operator types, and these may differ across Neo4j versions.
type Plan struct {
// Operator is the operation this plan is performing.
Operator string
// Arguments for the operator.
// Many operators have arguments defining their specific behavior. This map contains those arguments.
Arguments map[string]any
// List of identifiers used by this plan. Identifiers used by this part of the plan.
// These can be both identifiers introduced by you, or automatically generated.
Identifiers []string
// Zero or more child plans. A plan is a tree, where each child is another plan.
// The children are where this part of the plan gets its input records - unless this is an operator that
// introduces new records on its own.
Children []Plan
}
// ProfiledPlan is the same as a regular Plan - except this plan has been executed, meaning it also
// contains detailed information about how much work each step of the plan incurred on the database.
type ProfiledPlan struct {
// Operator contains the operation this plan is performing.
Operator string
// Arguments contains the arguments for the operator used.
// Many operators have arguments defining their specific behavior. This map contains those arguments.
Arguments map[string]any
// Identifiers contains a list of identifiers used by this plan. Identifiers used by this part of the plan.
// These can be both identifiers introduced by you, or automatically generated.
Identifiers []string
// DbHits contains the number of times this part of the plan touched the underlying data stores/
DbHits int64
// Records contains the number of records this part of the plan produced.
Records int64
// Children contains zero or more child plans. A plan is a tree, where each child is another plan.
// The children are where this part of the plan gets its input records - unless this is an operator that
// introduces new records on its own.
Children []ProfiledPlan
PageCacheMisses int64
PageCacheHits int64
PageCacheHitRatio float64
Time int64
}
type Notification struct {
Code string
Title string
Description string
Position *InputPosition
Severity string
Category string
}
// InputPosition contains information about a specific position in a statement
type InputPosition struct {
// Offset contains the character offset referred to by this position; offset numbers start at 0.
Offset int
// Line contains the line number referred to by this position; line numbers start at 1.
Line int
// Column contains the column number referred to by this position; column numbers start at 1.
Column int
}
type ProtocolVersion struct {
Major int
Minor int
}
type Summary struct {
Bookmark string
StmntType StatementType
ServerName string
Agent string
Major int
Minor int
Counters map[string]int
TFirst int64
TLast int64
Plan *Plan
ProfiledPlan *ProfiledPlan
Notifications []Notification
Database string
ContainsSystemUpdates *bool
ContainsUpdates *bool
}