$$SalesOrderTableTableManager constructor

$$SalesOrderTableTableManager(
  1. _$SharedDatabase db,
  2. $SalesOrderTable table
)

Implementation

$$SalesOrderTableTableManager(_$SharedDatabase db, $SalesOrderTable table)
  : super(
      TableManagerState(
        db: db,
        table: table,
        createFilteringComposer: () =>
            $$SalesOrderTableFilterComposer($db: db, $table: table),
        createOrderingComposer: () =>
            $$SalesOrderTableOrderingComposer($db: db, $table: table),
        createComputedFieldComposer: () =>
            $$SalesOrderTableAnnotationComposer($db: db, $table: table),
        updateCompanionCallback:
            ({
              Value<int> id = const Value.absent(),
              Value<DateTime> orderDateTime = const Value.absent(),
              Value<double> amount = const Value.absent(),
              Value<double> taxAmount = const Value.absent(),
              Value<String> status = const Value.absent(),
              Value<int> sellerId = const Value.absent(),
              Value<int> customerId = const Value.absent(),
            }) => SalesOrderCompanion(
              id: id,
              orderDateTime: orderDateTime,
              amount: amount,
              taxAmount: taxAmount,
              status: status,
              sellerId: sellerId,
              customerId: customerId,
            ),
        createCompanionCallback:
            ({
              Value<int> id = const Value.absent(),
              required DateTime orderDateTime,
              required double amount,
              required double taxAmount,
              required String status,
              required int sellerId,
              required int customerId,
            }) => SalesOrderCompanion.insert(
              id: id,
              orderDateTime: orderDateTime,
              amount: amount,
              taxAmount: taxAmount,
              status: status,
              sellerId: sellerId,
              customerId: customerId,
            ),
        withReferenceMapper: (p0) => p0
            .map(
              (e) => (
                e.readTable(table),
                $$SalesOrderTableReferences(db, table, e),
              ),
            )
            .toList(),
        prefetchHooksCallback:
            ({
              sellerId = false,
              customerId = false,
              salesOrderLineRefs = false,
            }) {
              return PrefetchHooks(
                db: db,
                explicitlyWatchedTables: [
                  if (salesOrderLineRefs) db.salesOrderLine,
                ],
                addJoins:
                    <
                      T extends TableManagerState<
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic,
                        dynamic
                      >
                    >(state) {
                      if (sellerId) {
                        state =
                            state.withJoin(
                                  currentTable: table,
                                  currentColumn: table.sellerId,
                                  referencedTable: $$SalesOrderTableReferences
                                      ._sellerIdTable(db),
                                  referencedColumn:
                                      $$SalesOrderTableReferences
                                          ._sellerIdTable(db)
                                          .id,
                                )
                                as T;
                      }
                      if (customerId) {
                        state =
                            state.withJoin(
                                  currentTable: table,
                                  currentColumn: table.customerId,
                                  referencedTable: $$SalesOrderTableReferences
                                      ._customerIdTable(db),
                                  referencedColumn:
                                      $$SalesOrderTableReferences
                                          ._customerIdTable(db)
                                          .id,
                                )
                                as T;
                      }

                      return state;
                    },
                getPrefetchedDataCallback: (items) async {
                  return [
                    if (salesOrderLineRefs)
                      await $_getPrefetchedData<
                        SalesOrderData,
                        $SalesOrderTable,
                        SalesOrderLineData
                      >(
                        currentTable: table,
                        referencedTable: $$SalesOrderTableReferences
                            ._salesOrderLineRefsTable(db),
                        managerFromTypedResult: (p0) =>
                            $$SalesOrderTableReferences(
                              db,
                              table,
                              p0,
                            ).salesOrderLineRefs,
                        referencedItemsForCurrentItem:
                            (item, referencedItems) => referencedItems.where(
                              (e) => e.salesOrderId == item.id,
                            ),
                        typedResults: items,
                      ),
                  ];
                },
              );
            },
      ),
    );