데이터 매퍼, 작업 단위 및 ID 맵 패턴을 기반으로 하는 Node.js 용 TypeScript ORM입니다. MongoDB, MySQL, MariaDB, PostgreSQL 및 SQLite 데이터베이스를 지원합니다.
https://github.com/mikro-orm/mikro-orm
작업 단위 (UOW)의 가장 중요한 의미는 트랜잭션을 자동으로 처리 할 수 있다는 것입니다.
em.flush()를 호출하면 계산 된 모든 변경 사항이 데이터베이스 트랜잭션 내에서 쿼리됩니다 (주어진 드라이버에서 지원하는 경우). 즉, em.persistLater()를 호출하여 트랜잭션의 경계를 제어 할 수 있으며 모든 변경 사항이 준비되면 flush()를 호출하여 트랜잭션 내에서 실행됩니다.
const user = await em.findOneOrFail(User, 1); user.email = 'foo@bar.com'; const car = new Car(); user.cars.add(car); // thanks to bi-directional cascading we only need to persist user entity // flushing will create a transaction, insert new car and update user with new email // as user entity is managed, calling flush() is enough await em.flush();
등록된 댓글이 없습니다.