zibri
    Preparing search index...

    Definition for a data source.

    interface DataSourceInterface {
        addPropertyToEntity: <T extends BaseEntity>(
            entity: Newable<T>,
            key: keyof T,
            transaction: Transaction,
        ) => Promise<void>;
        changePropertyOfEntity: <T extends BaseEntity>(
            entity: Newable<T>,
            oldProperty: string & {} | keyof T,
            newProperty: PropertyMetadataInput & {
                name?: keyof T;
                type:
                    | "string"
                    | "number"
                    | "boolean"
                    | "object"
                    | "array"
                    | "date"
                    | "unknown";
            },
            transaction: Transaction,
        ) => Promise<void>;
        createBackupData: (backup: BackupEntity) => Readable | Promise<Readable>;
        entities: Newable<BaseEntity>[];
        getRepository: <T extends BaseEntity>(cls: Newable<T>) => Repository<T>;
        init: () => Promise<void>;
        migrations: Newable<Migration>[];
        restoreBackup: (backupData: Readable) => void | Promise<void>;
        runMigrations: () => Promise<void>;
        startTransaction: (isolationLevel?: IsolationLevel) => Promise<Transaction>;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    addPropertyToEntity: <T extends BaseEntity>(
        entity: Newable<T>,
        key: keyof T,
        transaction: Transaction,
    ) => Promise<void>

    Adds a new property to the given entity.

    Mostly needed in the context of migrations.

    changePropertyOfEntity: <T extends BaseEntity>(
        entity: Newable<T>,
        oldProperty: string & {} | keyof T,
        newProperty: PropertyMetadataInput & {
            name?: keyof T;
            type:
                | "string"
                | "number"
                | "boolean"
                | "object"
                | "array"
                | "date"
                | "unknown";
        },
        transaction: Transaction,
    ) => Promise<void>

    Changes the given oldProperty to the newProperty on the given entity.

    createBackupData: (backup: BackupEntity) => Readable | Promise<Readable>

    Creates the data that should be backed up in form of a Readable stream.

    entities: Newable<BaseEntity>[]

    The entities of this data source.

    getRepository: <T extends BaseEntity>(cls: Newable<T>) => Repository<T>

    Gets a repository to manage the provided entity class in the data source.

    Type Declaration

    When the data source has not been initialized yet or the provided entity does not belong to this data source.

    init: () => Promise<void>

    Initializes the data source.

    migrations: Newable<Migration>[]

    All migrations that belong to this data source.

    restoreBackup: (backupData: Readable) => void | Promise<void>

    Restores this resource to the the given backup data.

    runMigrations: () => Promise<void>

    Runs migrations for the data source.

    startTransaction: (isolationLevel?: IsolationLevel) => Promise<Transaction>

    Starts a new transaction.

    Type Declaration

      • (isolationLevel?: IsolationLevel): Promise<Transaction>
      • Parameters

        • OptionalisolationLevel: IsolationLevel

          The isolation level of the transaction.

        Returns Promise<Transaction>

        A new transaction that can be passed to any repository methods.