EdgeOperations
age-schema-client / EdgeOperations
Class: EdgeOperations<T>
Defined in: src/db/edge.ts:91
Edge operations class
Provides type-safe methods for edge creation, retrieval, update, and deletion
Type Parameters
| Type Parameter |
|---|
T extends SchemaDefinition |
Constructors
Constructor
new EdgeOperations<T>(
schema,
queryExecutor,
sqlGenerator,
graphName?): EdgeOperations<T>;
Defined in: src/db/edge.ts:99
Create a new edge operations instance
Parameters
| Parameter | Type | Description |
|---|---|---|
schema | T | Schema definition |
queryExecutor | QueryExecutor | Query executor |
sqlGenerator | SQLGenerator | SQL generator |
graphName? | string | - |
Returns
EdgeOperations<T>
Methods
createEdge()
createEdge<L>(
label,
fromVertex,
toVertex,
data,
graphName?): Promise<Edge<T, L>>;
Defined in: src/db/edge.ts:116
Create a new edge
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromVertex | Vertex<T, any> | Source vertex |
toVertex | Vertex<T, any> | Target vertex |
data | EdgeData<T, L> | Edge data |
graphName? | string | Optional graph name to override the default |
Returns
Promise<Edge<T, L>>
Created edge
getEdgeById()
getEdgeById<L>(
label,
id,
graphName?): Promise<Edge<T, L>>;
Defined in: src/db/edge.ts:169
Get an edge by ID
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
id | string | Edge ID |
graphName? | string | - |
Returns
Promise<Edge<T, L>>
Edge or null if not found
getEdge()
getEdge<L>(
label,
fromProperties,
toProperties,
edgeProperties?,
graphName?): Promise<Edge<T, L>>;
Defined in: src/db/edge.ts:223
Get an edge by properties
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromProperties | Record<string, any> | Properties to match for the source vertex |
toProperties | Record<string, any> | Properties to match for the target vertex |
edgeProperties? | Record<string, any> | Properties to match for the edge |
graphName? | string | Graph name |
Returns
Promise<Edge<T, L>>
Edge or null if not found
getEdgesByLabel()
getEdgesByLabel<L>(
label,
options,
graphName?): Promise<Edge<T, L>[]>;
Defined in: src/db/edge.ts:351
Get edges by label
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
options | EdgeQueryOptions | Query options |
graphName? | string | - |
Returns
Promise<Edge<T, L>[]>
Array of edges
getEdgesBetweenVertices()
getEdgesBetweenVertices<L>(
label,
fromVertex,
toVertex,
graphName?): Promise<Edge<T, L>[]>;
Defined in: src/db/edge.ts:468
Get edges between vertices
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromVertex | Vertex<T, any> | Source vertex |
toVertex | Vertex<T, any> | Target vertex |
graphName? | string | - |
Returns
Promise<Edge<T, L>[]>
Array of edges
updateEdgeById()
updateEdgeById<L>(
label,
id,
data,
graphName?): Promise<Edge<T, L>>;
Defined in: src/db/edge.ts:517
Update an edge by ID
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
id | string | Edge ID |
data | Partial<EdgeData<T, L>> | Edge data to update |
graphName? | string | - |
Returns
Promise<Edge<T, L>>
Updated edge
updateEdge()
updateEdge<L>(
label,
fromProperties,
toProperties,
edgeProperties,
data,
graphName?): Promise<Edge<T, L>>;
Defined in: src/db/edge.ts:587
Update an edge by properties
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromProperties | Record<string, any> | Properties to match for the source vertex |
toProperties | Record<string, any> | Properties to match for the target vertex |
edgeProperties | Record<string, any> | Properties to match for the edge |
data | Partial<EdgeData<T, L>> | Edge data to update |
graphName? | string | Graph name |
Returns
Promise<Edge<T, L>>
Updated edge or null if not found
deleteEdgeById()
deleteEdgeById<L>(
label,
id,
graphName?): Promise<Edge<T, L>>;
Defined in: src/db/edge.ts:685
Delete an edge by ID
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
id | string | Edge ID |
graphName? | string | - |
Returns
Promise<Edge<T, L>>
Deleted edge
deleteEdge()
deleteEdge<L>(
label,
fromProperties,
toProperties,
edgeProperties?,
graphName?): Promise<boolean>;
Defined in: src/db/edge.ts:740
Delete an edge by properties
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromProperties | Record<string, any> | Properties to match for the source vertex |
toProperties | Record<string, any> | Properties to match for the target vertex |
edgeProperties? | Record<string, any> | Properties to match for the edge |
graphName? | string | Graph name |
Returns
Promise<boolean>
True if the edge was deleted
deleteEdgesBetweenVertices()
deleteEdgesBetweenVertices<L>(
label,
fromVertex,
toVertex,
graphName?): Promise<Edge<T, L>[]>;
Defined in: src/db/edge.ts:789
Delete edges between vertices
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromVertex | Vertex<T, any> | Source vertex |
toVertex | Vertex<T, any> | Target vertex |
graphName? | string | - |
Returns
Promise<Edge<T, L>[]>
Array of deleted edges
createEdgesBatch()
createEdgesBatch<L>(
label,
edges,
graphName?): Promise<Edge<T, L>[]>;
Defined in: src/db/edge.ts:843
Create multiple edges in a batch operation
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
edges | object[] | Array of edge data with source and target vertices |
graphName? | string | - |
Returns
Promise<Edge<T, L>[]>
Array of created edges
validateEdgeData()
validateEdgeData<L>(
label,
data,
isPartial): void;
Defined in: src/db/edge.ts:906
Validate edge data against schema
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
label | L | undefined | Edge label |
data | Partial<EdgeData<T, L>> | undefined | Edge data |
isPartial | boolean | false | Whether this is a partial update |
Returns
void
validateVertexTypes()
validateVertexTypes<L>(
label,
fromVertex,
toVertex): void;
Defined in: src/db/edge.ts:1058
Validate vertex types against edge constraints
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
fromVertex | Vertex<T, any> | Source vertex |
toVertex | Vertex<T, any> | Target vertex |
Returns
void
transformToEdge()
transformToEdge<L>(label, row): Edge<T, L>;
Defined in: src/db/edge.ts:1115
Transform database row to edge object
Type Parameters
| Type Parameter |
|---|
L extends string | number | symbol |
Parameters
| Parameter | Type | Description |
|---|---|---|
label | L | Edge label |
row | Record<string, any> | Database row |
Returns
Edge<T, L>
Edge object