chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -1173,21 +1173,22 @@ await this.graphIndex.addEdge(
|
|||
```
|
||||
|
||||
**Benefits**:
|
||||
- **O(1) relationship lookups**: `getRelations(entityId)` is instant
|
||||
- **O(1) relationship lookups**: `related(entityId)` is instant
|
||||
- **Bidirectional traversal**: Find incoming and outgoing edges
|
||||
- **Type filtering**: Get only `CreatedBy` relationships
|
||||
- **Global statistics**: Count relationships by type
|
||||
|
||||
**Query Examples**:
|
||||
```typescript
|
||||
// What did Mona Lisa create?
|
||||
const outgoing = await brain.getRelations('ent_mona_lisa_...', { direction: 'outgoing' })
|
||||
// What did Mona Lisa create? (outgoing edges)
|
||||
const outgoing = await brain.related({ from: 'ent_mona_lisa_...' })
|
||||
|
||||
// What created Mona Lisa?
|
||||
const incoming = await brain.getRelations('ent_mona_lisa_...', { direction: 'incoming' })
|
||||
// What created Mona Lisa? (incoming edges)
|
||||
const incoming = await brain.related({ to: 'ent_mona_lisa_...' })
|
||||
|
||||
// Get only CreatedBy relationships
|
||||
const createdBy = await brain.getRelations('ent_mona_lisa_...', {
|
||||
const createdBy = await brain.related({
|
||||
from: 'ent_mona_lisa_...',
|
||||
type: VerbType.CreatedBy
|
||||
})
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue