$$PortalApplicationCategoriesTableTableManager constructor

$$PortalApplicationCategoriesTableTableManager(
  1. _$AppDatabase db,
  2. $PortalApplicationCategoriesTable table
)

Implementation

$$PortalApplicationCategoriesTableTableManager(
  _$AppDatabase db,
  $PortalApplicationCategoriesTable table,
) : super(
      TableManagerState(
        db: db,
        table: table,
        createFilteringComposer: () =>
            $$PortalApplicationCategoriesTableFilterComposer(
              $db: db,
              $table: table,
            ),
        createOrderingComposer: () =>
            $$PortalApplicationCategoriesTableOrderingComposer(
              $db: db,
              $table: table,
            ),
        createComputedFieldComposer: () =>
            $$PortalApplicationCategoriesTableAnnotationComposer(
              $db: db,
              $table: table,
            ),
        updateCompanionCallback:
            ({
              Value<int> id = const Value.absent(),
              Value<int> user = const Value.absent(),
              Value<String> distinguishedName = const Value.absent(),
              Value<String> nameZh = const Value.absent(),
              Value<String?> nameEn = const Value.absent(),
              Value<int> position = const Value.absent(),
            }) => PortalApplicationCategoriesCompanion(
              id: id,
              user: user,
              distinguishedName: distinguishedName,
              nameZh: nameZh,
              nameEn: nameEn,
              position: position,
            ),
        createCompanionCallback:
            ({
              Value<int> id = const Value.absent(),
              required int user,
              required String distinguishedName,
              required String nameZh,
              Value<String?> nameEn = const Value.absent(),
              required int position,
            }) => PortalApplicationCategoriesCompanion.insert(
              id: id,
              user: user,
              distinguishedName: distinguishedName,
              nameZh: nameZh,
              nameEn: nameEn,
              position: position,
            ),
        withReferenceMapper: (p0) => p0
            .map(
              (e) => (
                e.readTable(table),
                $$PortalApplicationCategoriesTableReferences(db, table, e),
              ),
            )
            .toList(),
        prefetchHooksCallback: ({user = false, portalApplicationsRefs = false}) {
          return PrefetchHooks(
            db: db,
            explicitlyWatchedTables: [
              if (portalApplicationsRefs) db.portalApplications,
            ],
            addJoins:
                <
                  T extends TableManagerState<
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic,
                    dynamic
                  >
                >(state) {
                  if (user) {
                    state =
                        state.withJoin(
                              currentTable: table,
                              currentColumn: table.user,
                              referencedTable:
                                  $$PortalApplicationCategoriesTableReferences
                                      ._userTable(db),
                              referencedColumn:
                                  $$PortalApplicationCategoriesTableReferences
                                      ._userTable(db)
                                      .id,
                            )
                            as T;
                  }

                  return state;
                },
            getPrefetchedDataCallback: (items) async {
              return [
                if (portalApplicationsRefs)
                  await $_getPrefetchedData<
                    PortalApplicationCategory,
                    $PortalApplicationCategoriesTable,
                    PortalApplication
                  >(
                    currentTable: table,
                    referencedTable:
                        $$PortalApplicationCategoriesTableReferences
                            ._portalApplicationsRefsTable(db),
                    managerFromTypedResult: (p0) =>
                        $$PortalApplicationCategoriesTableReferences(
                          db,
                          table,
                          p0,
                        ).portalApplicationsRefs,
                    referencedItemsForCurrentItem: (item, referencedItems) =>
                        referencedItems.where((e) => e.category == item.id),
                    typedResults: items,
                  ),
              ];
            },
          );
        },
      ),
    );