# mikro-orm-arp

> Active Record Patter for mikro-orm

Latest version **1.0.6** (published 2020-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install mikro-orm-arp
pnpm add mikro-orm-arp
yarn add mikro-orm-arp
bun add mikro-orm-arp
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2020-09-14 |
| First published | 2020-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | cupcakearmy |
| Maintainers | cupcakearmy |

## Links

- npm: https://www.npmjs.com/package/mikro-orm-arp
- npm.io page: https://npm.io/package/mikro-orm-arp

## Recent versions

- 1.0.6 (latest) — 2020-09-14
- 1.0.5 — 2020-08-30
- 1.0.3 — 2020-08-30
- 1.0.2 — 2020-08-28
- 1.0.1 — 2020-08-28
- 1.0.0 — 2020-08-28

## README

# mikro-orm-arp

Active Record(-ish) Pattern for Mikro-ORM.

Ads the own repository functions to the class as static functions so you don't have to always retrieve them.

## 🏗 Installation

```bash
yarn add mikro-orm-arp
npm install mikro-orm-arp
```

## 🚀 Usage

```js
import { MikroORM, Entity, Property } from '@mikro-orm/core'
import { register, BaseEntity } from 'mikro-orm-arp'

@Entity()
export class Book extends BaseEntity {
  @Property()
  name: string = ''
}

MikroORM.init({
  entities: [Book, BaseEntity],
  // ...
}).then(async (db) => {
  register(db)

  // Find one
  const book: Book = await Book.findOneOrFail({ name: 'Journey to the center of the earth' })
 
  // Create and save
  const newBook = Book.create({ name: '' })
  Book.persist(newBook)
  await Book.flush

  // Repo
  const bookRepo = Book.getRepo()
})
```

---
_Source: https://npm.io/package/mikro-orm-arp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
