loadMin method

Future<OrmMigrationRecord> loadMin(
  1. String relation,
  2. String column, {
  3. String? alias,
  4. PredicateCallback<OrmEntity>? constraint,
})
inherited

Lazily loads the minimum value of a column in a relation.

Stores the min result as an attribute with the suffix _min_{column}.

Example:

await post.loadMin('comments', 'created_at');
final earliestComment = post.getAttribute('comments_min_created_at');

Implementation

Future<TModel> loadMin(
  String relation,
  String column, {
  String? alias,
  PredicateCallback<OrmEntity>? constraint,
}) async {
  return _loadAggregate(
    RelationAggregateType.min,
    relation,
    column,
    alias: alias,
    constraint: constraint,
  );
}