8000 GitHub - dohyuu/atxmic: Atxmic, The Atomic Transaction Management
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dohyuu/atxmic

Repository files navigation

Documentation is currently being written.
The API may change during development as it is still actively being developed.


IMAGE

Atxmic, The Atomic Transaction Management



Atxmic is a library that allows atomic management of database transactions.

Using with Prisma in NestJS

pnpm add atxmic
pnpm add @atxmic/prisma
pnpm add @atxmic/nestjs
// examples/nestjs-prisma/src/app.module.ts
import { TransactionModule } from "@atxmic/nestjs"
import { Module } from "@nestjs/common"
import { PrismaService } from "./infra/prisma.service"

@Module({
  imports: [
    PrismaModule,
    TransactionModule.register({
      client: PrismaService,
    }),
  ],
  controllers: [PostsController],
  providers: [PostService],
})
export class AppModule {}
// examples/nestjs-prisma/src/posts.controller.ts
import { Transactional } from "@atxmic/nestjs"
import { Body, Controller, Post } from "@nestjs/common"

@Controller("posts")
export class PostsController {
  constructor(
    private readonly postService: PostService,
  ) {}

  @Post()
  @Transactional()
  async create(@Body() body) {
    const author = await this.userService.createUser({
      name: body.name,
      address: body.address,
    })

    const post = await this.postService.createPost(author.id, {
      title: body.title,
      content: body.content,
    })

    return {
      data: post,
    }
  }
}

Roadmap

  • TypeORM support
  • Sequelize support
  • Drizzle support
  • Add Express examples
  • Distributed transaction support

About

Atxmic, The Atomic Transaction Management

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0