Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Use custom abstract class #288

@ivawzh

Description

@ivawzh

Hi, thanks for the great work!

I am wondering if it is possible to pass my own abstract class?

I am trying to implement something like ActiveModel's conventional ApplicationRecord. I.e. a base abstract class inherited by all entities.

I'd imagine it will be something similar to the existing activeRecord flag, but instead of boolean, it will let me define a path to my own abstract class.

E.g.

Engine.createModelFromDatabase(
  Engine.createDriver(ormconfig.type),
  {
    ...
  },
  {
    abstractClassPath: './src/custom-base-entity.ts',
  }
)
// at ./src/custom-base-entity.ts

import { BaseEntity } from "typeorm"

export default abstract class CustomBaseEntity extends BaseEntity {
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementnew feature or bug with easy workaround

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions