Composer<Database extends GeneratedDatabase, CurrentTable extends Table> constructor

Composer<Database extends GeneratedDatabase, CurrentTable extends Table>({
  1. required Database $db,
  2. required CurrentTable $table,
  3. required JoinBuilder? joinBuilder,
  4. void $addJoinBuilderToRootComposer(
    1. JoinBuilder
    )?,
  5. void $removeJoinBuilderFromRootComposer(
    1. JoinBuilder
    )?,
})

Base class for all composers

A composer can create child composers which can create more child composers. When a child composer is created, a join builder is created and added to the root composer.

When the composer is finished, the $joinBuilders list will contain all the join builders that are needed to create the query.

Implementation

Composer({
  required this.$db,
  required this.$table,
  required JoinBuilder? joinBuilder,
  void Function(JoinBuilder)? $addJoinBuilderToRootComposer,
  void Function(JoinBuilder)? $removeJoinBuilderFromRootComposer,
}) : $joinBuilder = joinBuilder {
  this.$addJoinBuilderToRootComposer = $addJoinBuilderToRootComposer ??
      ((JoinBuilder joinBuilder) => $joinBuilders.add(joinBuilder));
  this.$removeJoinBuilderFromRootComposer =
      $removeJoinBuilderFromRootComposer ??
          ((JoinBuilder joinBuilder) => $joinBuilders.remove(joinBuilder));
}