Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @midwayjs/orm

References

Configuration

Configuration:

ORM_HOOK_KEY

ORM_HOOK_KEY:

OrmConnectionHook

OrmConnectionHook:

OrmHook

OrmHook:

getCustomRepository

getCustomRepository:

getMongoRepository

getMongoRepository:

getRepository

getRepository:

getTreeRepository

getTreeRepository:

Type aliases

GetConnection

GetConnection: function

Type declaration

    • (instanceName?: string): Connection
    • Parameters

      • Optional instanceName: string

      Returns Connection

getCustomRepository

getCustomRepository: function

Gets custom entity repository marked with @EntityRepository decorator.

Type declaration

    • <T>(customRepository: ObjectType<T>): T
    • Type parameters

      • T

      Parameters

      • customRepository: ObjectType<T>

      Returns T

getMongoRepository

getMongoRepository: function

Gets mongodb-specific repository for the given entity class or name. Works only if connection is mongodb-specific.

Type declaration

    • <Entity>(target: ObjectType<Entity> | EntitySchema<Entity> | string): MongoRepository<Entity>
    • Type parameters

      • Entity

      Parameters

      • target: ObjectType<Entity> | EntitySchema<Entity> | string

      Returns MongoRepository<Entity>

getRepository

getRepository: function

Gets repository for the given entity.

Type declaration

    • <Entity>(target: ObjectType<Entity> | EntitySchema<Entity> | string): Repository<Entity>
    • Type parameters

      • Entity

      Parameters

      • target: ObjectType<Entity> | EntitySchema<Entity> | string

      Returns Repository<Entity>

getTreeRepository

getTreeRepository: function

Gets tree repository for the given entity class or name. Only tree-type entities can have a TreeRepository, like ones decorated with @Tree decorator.

Type declaration

    • <Entity>(target: ObjectType<Entity> | EntitySchema<Entity> | string): TreeRepository<Entity>
    • Type parameters

      • Entity

      Parameters

      • target: ObjectType<Entity> | EntitySchema<Entity> | string

      Returns TreeRepository<Entity>

Variables

Const CONNECTION_KEY

CONNECTION_KEY: "orm:getConnection" = "orm:getConnection"

Const ENTITY_MODEL_KEY

ENTITY_MODEL_KEY: "entity_model_key" = "entity_model_key"

Const EVENT_SUBSCRIBER_KEY

EVENT_SUBSCRIBER_KEY: "event_subscriber_key" = "event_subscriber_key"

Const ORM_HOOK_KEY

ORM_HOOK_KEY: "__orm_hook_for_configuration__" = "__orm_hook_for_configuration__"

Const ORM_MODEL_KEY

ORM_MODEL_KEY: "__orm_model_key__" = "__orm_model_key__"

Functions

EntityModel

EntityView

  • EntityView(options?: ViewEntityOptions): ClassDecorator
  • EntityView(name?: string, options?: ViewEntityOptions): ClassDecorator
  • ViewEntity - typeorm

    Parameters

    • Optional options: ViewEntityOptions

      ViewEntityOptions

    Returns ClassDecorator

  • Entity - ViewEntity

    Parameters

    • Optional name: string

      string

    • Optional options: ViewEntityOptions

      ViewEntityOptions

    Returns ClassDecorator

EventSubscriberModel

  • EventSubscriberModel(options?: object): ClassDecorator
  • EventSubscriber - typeorm implements EntitySubscriberInterface

    Parameters

    • Default value options: object = {}
      • Optional connectionName?: string

    Returns ClassDecorator

InjectEntityModel

  • InjectEntityModel(modelKey?: any, connectionName?: string): (Anonymous function)

OrmHook

  • OrmHook(): ClassDecorator

getCustomRepository

  • getCustomRepository(context: IMidwayContainer, args?: any): (Anonymous function)

getMongoRepository

  • getMongoRepository(context: IMidwayContainer, args?: any): (Anonymous function)

getRepository

  • getRepository(context: IMidwayContainer, args?: any): (Anonymous function)

getTreeRepository

  • getTreeRepository(context: IMidwayContainer, args?: any): (Anonymous function)

useEntityModel

  • useEntityModel<Entity>(clz: ObjectType<Entity>, connectionName?: string): Repository<Entity>
  • for hooks useEntityModel method

    Type parameters

    • Entity

    Parameters

    • clz: ObjectType<Entity>
    • Optional connectionName: string

    Returns Repository<Entity>

Generated using TypeDoc