loadMax method

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

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

Stores the max result as an attribute with the suffix _max_{column}.

Example:

await post.loadMax('comments', 'created_at');
final latestComment = post.getAttribute('comments_max_created_at');

Implementation

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