getRelationsBetween method

  1. @override
Iterable<Relation> getRelationsBetween(
  1. String fromNodeId,
  2. String toNodeId, {
  3. bool bothDirections = true,
})
override

Get relations from a given node to another (by id)

Implementation

@override
Iterable<Relation> getRelationsBetween(
  String fromNodeId,
  String toNodeId, {
  bool bothDirections = true,
}) {
  final side1 = _mapRelations(
    _select(
      'relations',
      where: 'toNodeId = ? AND fromNodeId = ?',
      whereArgs: [toNodeId, fromNodeId],
    ),
  ).toList(growable: false);

  if (bothDirections) {
    if (fromNodeId == toNodeId) {
      return side1;
    }
    final side2 = _mapRelations(
      _select(
        'relations',
        where: 'fromNodeId = ? AND toNodeId = ?',
        whereArgs: [toNodeId, fromNodeId],
      ),
    ).toList(growable: false);
    return side1 + side2;
  }

  return side1;
}