# orm-transaction

> ORM Transactions

Latest version **0.0.2** (published 2013-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install orm-transaction
pnpm add orm-transaction
yarn add orm-transaction
bun add orm-transaction
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2013-07-15 |
| First published | 2013-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 22 |
| Author | Diogo Resende |
| Maintainers | dresende |
| Keywords | orm, transaction |

## Links

- npm: https://www.npmjs.com/package/orm-transaction
- Repository: http://github.com/dresende/node-orm-transaction
- Issues: https://github.com/dresende/node-orm-transaction/issues
- npm.io page: https://npm.io/package/orm-transaction

## Dependencies (2)

- [orm](https://npm.io/package/orm.md) >2.0.12
- [debug](https://npm.io/package/debug.md) ~0.7.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2013-07-15
- 0.0.1 — 2013-06-06

## README

## ORM Transaction Plugin [![](https://badge.fury.io/js/orm-paging.png)](https://npmjs.org/package/orm-transaction)

This plugin adds a transaction function for [ORM](http://dresende.github.io/node-orm2).

## Dependencies

Of course you need `orm` to use it. Other than that, no more dependencies.

## Install

```sh
npm install orm-transaction
```

## DBMS Support

Any driver supported by ORM is supported by this plugin.

## Usage

```js
db.transaction(function (err, transaction) {
	// do your stuff
	transaction.commit(function (err) {
		if (!err) {
			console.log("success!");
		}
	});
});
```

## Example

```js
var orm = require("orm");
var transaction = require("orm-transaction");

orm.connect("mysql://username:password@host/database", function (err, db) {
	if (err) throw err;

	db.use(transaction);

	var Person = db.define("person", {
		name      : String,
		surname   : String,
		age       : Number
	});

	db.transaction(function (err, t) {
		Person.find({ surname: "Doe" }).each(function (person) {
			person.remove();
		});

		t.commit();
	});
});
```

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