Libraries
    Preparing search index...

    Type Alias DbContext<TMap>

    DbContext: { readonly [K in keyof TMap]: DbSet<TMap[K]> } & {
        knex: Knex;
        transaction<T>(callback: (db: DbContext<TMap>) => Promise<T>): Promise<T>;
        withTransaction(trx: Transaction): DbContext<TMap>;
    }

    The shape of the context object returned by createDb: every registered entity becomes a typed DbSet property.

    Type Parameters

    Type Declaration

    • Readonlyknex: Knex

      The underlying Knex instance the context was constructed with.

    • transaction: function
      • Run callback inside a Knex transaction. The callback receives a new DbContext whose DbSets are bound to the transaction.

        Type Parameters

        • T

        Parameters

        Returns Promise<T>

    • withTransaction: function