1717 * limitations under the License.
1818 */
1919
20- import { int , isInt } from './integer' ;
20+ import { isInt } from './integer' ;
2121
2222/**
2323 * A ResultSummary instance contains structured metadata for a {Result}.
@@ -31,19 +31,79 @@ class ResultSummary {
3131 * @param {Object } metadata - Statement metadata
3232 */
3333 constructor ( statement , parameters , metadata ) {
34+ /**
35+ * The statement and parameters this summary is for.
36+ * @type {{text: string, parameters: Object} }
37+ * @public
38+ */
3439 this . statement = { text : statement , parameters} ;
40+
41+ /**
42+ * The type of statement executed. Can be "r" for read-only statement, "rw" for read-write statement,
43+ * "w" for write-only statement and "s" for schema-write statement.
44+ * String constants are available in {@link statementType} object.
45+ * @type {string }
46+ * @public
47+ */
3548 this . statementType = metadata . type ;
36- let counters = new StatementStatistics ( metadata . stats || { } ) ;
37- this . counters = counters ;
49+
50+ /**
51+ * Counters for operations the statement triggered.
52+ * @type {StatementStatistics }
53+ * @public
54+ */
55+ this . counters = new StatementStatistics ( metadata . stats || { } ) ;
3856 //for backwards compatibility, remove in future version
39- this . updateStatistics = counters ;
57+ this . updateStatistics = this . counters ;
58+
59+ /**
60+ * This describes how the database will execute the statement.
61+ * Statement plan for the executed statement if available, otherwise undefined.
62+ * Will only be populated for queries that start with "EXPLAIN".
63+ * @type {Plan }
64+ */
4065 this . plan = metadata . plan || metadata . profile ? new Plan ( metadata . plan || metadata . profile ) : false ;
66+
67+ /**
68+ * This describes how the database did execute your statement. This will contain detailed information about what
69+ * each step of the plan did. Profiled statement plan for the executed statement if available, otherwise undefined.
70+ * Will only be populated for queries that start with "PROFILE".
71+ * @type {ProfiledPlan }
72+ * @public
73+ */
4174 this . profile = metadata . profile ? new ProfiledPlan ( metadata . profile ) : false ;
75+
76+ /**
77+ * An array of notifications that might arise when executing the statement. Notifications can be warnings about
78+ * problematic statements or other valuable information that can be presented in a client. Unlike failures
79+ * or errors, notifications do not affect the execution of a statement.
80+ * @type {Array<Notification> }
81+ * @public
82+ */
4283 this . notifications = this . _buildNotifications ( metadata . notifications ) ;
84+
85+ /**
86+ * The basic information of the server where the result is obtained from.
87+ * @type {ServerInfo }
88+ * @public
89+ */
4390 this . server = new ServerInfo ( metadata . server ) ;
91+
92+ /**
93+ * The time it took the server to consume the result.
94+ * @type {number }
95+ * @public
96+ */
4497 this . resultConsumedAfter = metadata . result_consumed_after ;
98+
99+ /**
100+ * The time it took the server to make the result available for consumption in milliseconds.
101+ * @type {number }
102+ * @public
103+ */
45104 this . resultAvailableAfter = metadata . result_available_after ;
46105 }
106+
47107 _buildNotifications ( notifications ) {
48108 if ( ! notifications ) {
49109 return [ ] ;
0 commit comments