loadWith<T extends Entity> method
Loads the first entity of the given criteria, or returns null if none. *
-
whereClause
- the where clause.
- 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<T?> loadWith<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 row = await StreamUtil.first(queryFrom(fds,
fromClause ?? newInstance('*').otype,
_limit1(whereClause), whereValues, shortcut, option));
return toEntity(row, fields, newInstance);
}