@banana-universe/plugin-typeorm
v0.1.1
Published
TypeORM plugin for BananaJS — DataSource registration, @InjectRepository, and @Transactional decorator.
Readme
@banana-universe/plugin-typeorm
TypeORM integration plugin for BananaJS with DataSource registration and transactional helpers.
Homepage
https://surya-manne.github.io/banana-universe/
Installation
npm install @banana-universe/plugin-typeorm typeorm reflect-metadataCore API Surface
TypeOrmPlugin(options)Transactional()TransactionContextInjectRepository(Entity)
Minimal Working Setup
import { BananaApp } from '@banana-universe/bananajs';
import { TypeOrmPlugin } from '@banana-universe/plugin-typeorm';
await BananaApp.create({
controllers: [],
plugins: [
TypeOrmPlugin({
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: 'postgres',
database: 'banana',
entities: [],
synchronize: false,
}),
],
});Transactional Method Example
import { Transactional } from '@banana-universe/plugin-typeorm';
class OrderService {
@Transactional()
async placeOrder() {
// all DB work inside one transaction
}
}Documentation
- Project docs: https://surya-manne.github.io/banana-universe/
License
MIT
