loadAllWith<T extends Entity> method

Future<List<T>> loadAllWith<T extends Entity>(
  1. Iterable<String>? fields,
  2. T newInstance(
    1. String oid
    ),
  3. String? whereClause, [
  4. Map<String, dynamic>? whereValues,
  5. String? fromClause,
  6. String? shortcut,
  7. AccessOption? option,
])

Loads all entities of the given criteria (never null). *

    • whereClause - if null, no where clause is generated.
  • That is, the whole table will be loaded.
  • Note: it shall not include where.
  • Example: "$fdType" = 23
    • fromClause - if null, the entity's table is assumed.
  • Note: it shall not include from.
  • Example: "$otTask" inner join "$otGrant"
    • shortcut - the table shortcut to prefix the column names.
  • Default: none. Useful if you joined other tables in fromClause.
  • Note: shortcut is case insensitive.

Implementation

Future<List<T>> loadAllWith<T extends Entity>(
    Iterable<String>? fields, T newInstance(String oid),
    String? whereClause, [Map<String, dynamic>? whereValues,
    String? fromClause, String? shortcut, AccessOption? option]) async {
  Set<String>? fds;
  if (fields != null) {
    fds = LinkedHashSet<String>();
    fds..add(fdOid)..addAll(fields);
  }

  final entities = <T>[];
  await for (final row in
      queryFrom(fds, fromClause ?? newInstance('*').otype,
      whereClause, whereValues, shortcut, option)) {
    entities.add(toEntityNS(row, fields, newInstance));
  }
  return entities;
}