queryFirstValue method

Future queryFirstValue(
  1. QueryPart query(
    1. T model
    ), {
  2. ConditionQuery where(
    1. T model
    )?,
  3. List<FieldOrder> orderBy(
    1. T model
    )?,
})

Get first row first field value

Implementation

Future queryFirstValue(QueryPart Function(T model) query,
    {ConditionQuery Function(T model)? where,
    List<FieldOrder> Function(T model)? orderBy}) async {
  // assert(query != null);
  var result = await this.query(
      queries: (model) => [query.call(model)],
      where: where,
      limit: 1,
      orderBy: orderBy);

  if (result != null) {
    if (result is List) {
      if (result.isNotEmpty) if (result[0] != null) return result[0].row[0];
    }
  }
  return null;
}