AnalyticsMatchClause
age-schema-client / AnalyticsMatchClause
Class: AnalyticsMatchClause<T, L>
Defined in: src/query/analytics.ts:27
Analytics match clause class
Extends the standard match clause with analytics capabilities
Extends
MatchClause<T,L>
Extended by
Type Parameters
| Type Parameter |
|---|
T extends SchemaDefinition |
L extends keyof T["vertices"] |
Constructors
Constructor
new AnalyticsMatchClause<T, L>(
queryBuilder,
matchPart,
vertexPattern): AnalyticsMatchClause<T, L>;
Defined in: src/query/analytics.ts:38
Create a new analytics match clause
Parameters
| Parameter | Type | Description |
|---|---|---|
queryBuilder | AnalyticsQueryBuilder<T> | Query builder |
matchPart | MatchPart | Match part |
vertexPattern | VertexPattern | Vertex pattern |
Returns
AnalyticsMatchClause<T, L>
Overrides
Methods
count()
count(
alias,
resultAlias,
distinct): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:55
Count vertices or edges
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
alias | string | undefined | Alias of the vertex or edge to count |
resultAlias | string | 'count' | Alias for the count result (default: 'count') |
distinct | boolean | false | Whether to count distinct elements (default: false) |
Returns
The analytics query builder
sum()
sum(expression, resultAlias): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:69
Sum values of a property
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
expression | string | undefined | Expression to sum (e.g., 'n.age') |
resultAlias | string | 'sum' | Alias for the sum result (default: 'sum') |
Returns
The analytics query builder
avg()
avg(expression, resultAlias): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:82
Calculate average of a property
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
expression | string | undefined | Expression to average (e.g., 'n.age') |
resultAlias | string | 'avg' | Alias for the average result (default: 'avg') |
Returns
The analytics query builder
min()
min(expression, resultAlias): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:95
Find minimum value of a property
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
expression | string | undefined | Expression to find minimum (e.g., 'n.age') |
resultAlias | string | 'min' | Alias for the minimum result (default: 'min') |
Returns
The analytics query builder
max()
max(expression, resultAlias): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:108
Find maximum value of a property
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
expression | string | undefined | Expression to find maximum (e.g., 'n.age') |
resultAlias | string | 'max' | Alias for the maximum result (default: 'max') |
Returns
The analytics query builder
aggregate()
aggregate(
functionName,
expression,
resultAlias): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:122
Apply a custom aggregation function
Parameters
| Parameter | Type | Description |
|---|---|---|
functionName | string | Aggregation function name |
expression | string | Expression to aggregate |
resultAlias | string | Alias for the result |
Returns
The analytics query builder
match()
match<K>(label, alias): AnalyticsMatchClause<T, K>;
Defined in: src/query/analytics.ts:135
Add another match clause
Type Parameters
| Type Parameter |
|---|
K extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | K | Vertex label |
alias | string | Vertex alias |
Returns
AnalyticsMatchClause<T, K>
A new analytics match clause
where()
where(condition, params?): this;
Defined in: src/query/analytics.ts:147
Add WHERE clause
Parameters
| Parameter | Type | Description |
|---|---|---|
condition | string | Condition expression |
params? | Record<string, any> | Parameters |
Returns
this
This analytics match clause
Overrides
return()
return(...expressions): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:161
Add RETURN clause
Parameters
| Parameter | Type | Description |
|---|---|---|
...expressions | string[] | Return expressions |
Returns
This analytics query builder
groupBy()
groupBy(...fields): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:173
Add GROUP BY clause
Parameters
| Parameter | Type | Description |
|---|---|---|
...fields | string[] | Fields to group by |
Returns
This analytics query builder
windowFunction()
windowFunction(
functionType,
resultAlias,
options): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:187
Add a window function to the query
Parameters
| Parameter | Type | Description |
|---|---|---|
functionType | string | Window function type |
resultAlias | string | Alias for the window function result |
options | WindowFunctionOptions | Window function options |
Returns
This analytics query builder
rowNumber()
rowNumber(resultAlias, options): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:204
Add ROW_NUMBER window function
Parameters
| Parameter | Type | Description |
|---|---|---|
resultAlias | string | Alias for the result |
options | WindowFunctionOptions | Window function options |
Returns
This analytics query builder
rank()
rank(resultAlias, options): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:217
Add RANK window function
Parameters
| Parameter | Type | Description |
|---|---|---|
resultAlias | string | Alias for the result |
options | WindowFunctionOptions | Window function options |
Returns
This analytics query builder
denseRank()
denseRank(resultAlias, options): AnalyticsQueryBuilder<T>;
Defined in: src/query/analytics.ts:230
Add DENSE_RANK window function
Parameters
| Parameter | Type | Description |
|---|---|---|
resultAlias | string | Alias for the result |
options | WindowFunctionOptions | Window function options |
Returns
This analytics query builder
constraint()
constraint(properties): this;
Defined in: src/query/clauses.ts:49
Add property constraints to the vertex pattern
Parameters
| Parameter | Type | Description |
|---|---|---|
properties | Record<string, any> | Object with property-value pairs |
Returns
this
This match clause
Throws
Error if any property value is null, undefined, or NaN
Inherited from
outgoing()
outgoing<E>(
label,
alias,
targetLabel,
targetAlias): this;
Defined in: src/query/clauses.ts:98
Add outgoing edge
Type Parameters
| Type Parameter |
|---|
E extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | E | Edge label |
alias | string | Edge alias |
targetLabel | keyof T["vertices"] | Target vertex label |
targetAlias | string | Target vertex alias |
Returns
this
This match clause
Inherited from
incoming()
incoming<E>(
label,
alias,
sourceLabel,
sourceAlias): this;
Defined in: src/query/clauses.ts:148
Add incoming edge
Type Parameters
| Type Parameter |
|---|
E extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | E | Edge label |
alias | string | Edge alias |
sourceLabel | keyof T["vertices"] | Source vertex label |
sourceAlias | string | Source vertex alias |
Returns
this
This match clause
Inherited from
related()
related<E>(
label,
alias,
otherLabel,
otherAlias): this;
Defined in: src/query/clauses.ts:198
Add bidirectional edge
Type Parameters
| Type Parameter |
|---|
E extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | E | Edge label |
alias | string | Edge alias |
otherLabel | keyof T["vertices"] | Other vertex label |
otherAlias | string | Other vertex alias |
Returns
this
This match clause
Inherited from
done()
done(): IQueryBuilder<T>;
Defined in: src/query/clauses.ts:244
Return to the main query builder
Returns
Query builder