@nestjs/typeorm

  • Version 8.0.3
  • Published
  • 42.8 kB
  • 1 dependency
  • MIT license

Install

npm i @nestjs/typeorm
yarn add @nestjs/typeorm
pnpm add @nestjs/typeorm

Overview

Nest - modern, fast, powerful node.js web framework (@typeorm)

Index

Functions

function generateString

generateString: () => string;

    function getConnectionName

    getConnectionName: (options: ConnectionOptions) => string;

      function getConnectionPrefix

      getConnectionPrefix: (
      connection?: Connection | ConnectionOptions | string
      ) => string;
      • This function returns a Connection prefix based on the connection name

        Parameter connection

        This optional parameter is either a Connection, or a ConnectionOptions or a string.

        Returns

        {string | Function} The Connection injection token.

      function getConnectionToken

      getConnectionToken: (
      connection?: Connection | ConnectionOptions | string
      ) => string | Function | Type<Connection>;
      • This function returns a Connection injection token for the given Connection, ConnectionOptions or connection name.

        Parameter connection

        This optional parameter is either a Connection, or a ConnectionOptions or a string.

        Returns

        {string | Function} The Connection injection token.

      function getCustomRepositoryToken

      getCustomRepositoryToken: (repository: Function) => string;
      • This function generates an injection token for an Entity or Repository

        Parameter This

        parameter can either be an Entity or Repository

        Returns

        {string} The Repository injection token

      function getEntityManagerToken

      getEntityManagerToken: (
      connection?: Connection | ConnectionOptions | string
      ) => string | Function;
      • This function returns an EntityManager injection token for the given Connection, ConnectionOptions or connection name.

        Parameter connection

        This optional parameter is either a Connection, or a ConnectionOptions or a string.

        Returns

        {string | Function} The EntityManager injection token.

      function getRepositoryToken

      getRepositoryToken: (
      entity: EntityClassOrSchema,
      connection?: Connection | ConnectionOptions | string
      ) => Function | string;
      • This function generates an injection token for an Entity or Repository

        Parameter entity

        parameter can either be an Entity or Repository

        Parameter connection

        Connection name

        Returns

        {string} The Entity | Repository injection token

      function handleRetry

      handleRetry: (
      retryAttempts?: number,
      retryDelay?: number,
      connectionName?: string,
      verboseRetryLog?: boolean,
      toRetry?: (err: any) => boolean
      ) => <T>(source: Observable<T>) => Observable<T>;

        function InjectConnection

        InjectConnection: (
        connection?: Connection | ConnectionOptions | string
        ) => ReturnType<typeof Inject>;

          function InjectEntityManager

          InjectEntityManager: (
          connection?: Connection | ConnectionOptions | string
          ) => ReturnType<typeof Inject>;

            function InjectRepository

            InjectRepository: (
            entity: EntityClassOrSchema,
            connection?: string
            ) => ReturnType<typeof Inject>;

              Classes

              class TypeOrmModule

              class TypeOrmModule {}

                method forFeature

                static forFeature: (
                entities?: EntityClassOrSchema[],
                connection?: Connection | ConnectionOptions | string
                ) => DynamicModule;

                  method forRoot

                  static forRoot: (options?: TypeOrmModuleOptions) => DynamicModule;

                    method forRootAsync

                    static forRootAsync: (options: TypeOrmModuleAsyncOptions) => DynamicModule;

                      Interfaces

                      interface TypeOrmModuleAsyncOptions

                      interface TypeOrmModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {}

                        property connectionFactory

                        connectionFactory?: TypeOrmConnectionFactory;

                          property inject

                          inject?: any[];

                            property name

                            name?: string;

                              property useClass

                              useClass?: Type<TypeOrmOptionsFactory>;

                                property useExisting

                                useExisting?: Type<TypeOrmOptionsFactory>;

                                  property useFactory

                                  useFactory?: (
                                  ...args: any[]
                                  ) => Promise<TypeOrmModuleOptions> | TypeOrmModuleOptions;

                                    interface TypeOrmOptionsFactory

                                    interface TypeOrmOptionsFactory {}

                                      method createTypeOrmOptions

                                      createTypeOrmOptions: (
                                      connectionName?: string
                                      ) => Promise<TypeOrmModuleOptions> | TypeOrmModuleOptions;

                                        Type Aliases

                                        type TypeOrmConnectionFactory

                                        type TypeOrmConnectionFactory = (options?: ConnectionOptions) => Promise<Connection>;

                                          type TypeOrmModuleOptions

                                          type TypeOrmModuleOptions = {
                                          /**
                                          * Number of times to retry connecting
                                          * Default: 10
                                          */
                                          retryAttempts?: number;
                                          /**
                                          * Delay between connection retry attempts (ms)
                                          * Default: 3000
                                          */
                                          retryDelay?: number;
                                          /**
                                          * Function that determines whether the module should
                                          * attempt to connect upon failure.
                                          *
                                          * @param err error that was thrown
                                          * @returns whether to retry connection or not
                                          */
                                          toRetry?: (err: any) => boolean;
                                          /**
                                          * If `true`, entities will be loaded automatically.
                                          */
                                          autoLoadEntities?: boolean;
                                          /**
                                          * If `true`, connection will not be closed on application shutdown.
                                          */
                                          keepConnectionAlive?: boolean;
                                          /**
                                          * If `true`, will show verbose error messages on each connection retry.
                                          */
                                          verboseRetryLog?: boolean;
                                          } & Partial<ConnectionOptions>;

                                            Package Files (5)

                                            Dependencies (1)

                                            Dev Dependencies (28)

                                            Peer Dependencies (5)

                                            Badge

                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@nestjs/typeorm.

                                            • Markdown
                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@nestjs/typeorm)
                                            • HTML
                                              <a href="https://www.jsdocs.io/package/@nestjs/typeorm"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>