Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
mikro-orm-plus
Advanced tools
Some useful features for MikroORM
$ npm install mikro-orm-plus
$ yarn add mikro-orm-plus
$ pnpm install mikro-orm-plus
Special property that is automatically set to the entity's insertion time. You don't need to write a value into this property - it will be automatically set.
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
import { CreateDateProperty } from 'mikro-orm-plus';
@Entity()
export class User {
@PrimaryKey()
id!: number;
@Property()
name!: string;
@CreateDateProperty()
createdAt: Date;
}
Special property that is automatically set to the entity's update time. You don't need to write a value into this property - it will be automatically set.
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
import { UpdateDateProperty } from 'mikro-orm-plus';
@Entity()
export class User {
@PrimaryKey()
id: number;
@Property()
name: string;
@UpdateDateProperty()
updatedAt: Date;
}
Special property that is automatically set to the entity's delete time. You don't need to write a value into this property - it will be automatically set.
This feature is base on mikro-orm-soft-delete, modified as a property decorator implementation.
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
import { DeleteDateProperty } from 'mikro-orm-plus';
@Entity()
export class User {
@PrimaryKey()
id: number;
@Property()
name: string;
@DeleteDateProperty()
deletedAt: Date;
}
Consistent with mikroOrm's api, just use em.remove()
or em.removeAndFlush()
to delete entity.
await em.removeAndFlush(user);
You need disabled soft delete filter, and then you can find soft deleted entity.
em.find(User, {...}, { filters: { [SOFT_DELETABLE_FILTER]: false } });
em.find(User, {...}, { filters: false }); // if you are sure that there are no other filters enabled
You can use em.nativeDelete()
to hard delete entity.
FAQs
Some useful features for MikroORM
The npm package mikro-orm-plus receives a total of 1 weekly downloads. As such, mikro-orm-plus popularity was classified as not popular.
We found that mikro-orm-plus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.