getSumProduct<T> method
Future<T>
getSumProduct<T>({
- required Iterable<
ColumnDefinition< columns(IEntity, dynamic> >- TMeta t
- Filter where(
- TMeta t
- bool? useIsolate,
- Map<
String, dynamic> ? isolateArgs, - void onIsolatePreMap()?,
inherited
Implementation
@override
Future<T> getSumProduct<T>({
required Iterable<ColumnDefinition> Function(TMeta t) columns,
Filter Function(TMeta t)? where,
final bool? useIsolate,
Map<String, dynamic>? isolateArgs,
void Function(Map<String, dynamic>? isolateArgs)? onIsolatePreMap,
}) async {
final cols = columns(t).map((e) => e.name).join(' * ');
List<Map> result = await rawQuery(
where,
'SELECT SUM ($cols) FROM ${t.tableName}',
useIsolate: useIsolate,
isolateArgs: isolateArgs,
onIsolatePreMap: onIsolatePreMap,
);
if (result.isNotEmpty) {
final firstRow = result.first;
if (firstRow.isNotEmpty && firstRow.values.first != null) {
return asCast<T>(firstRow.values.first);
}
}
return asCast<T>(0);
}