Skip to content

jongyunha/gorm-tx-manager

Repository files navigation

GORM Transaction Manager

A Spring Boot @Transactional inspired transaction manager for GORM that provides declarative transaction management through function decorators.

Features

  • 🔄 Declarative transaction management
  • 🎯 Multiple propagation levels (REQUIRED, REQUIRES_NEW, SUPPORTS, etc.)
  • 🔒 Isolation level support
  • 🔄 Automatic rollback on errors
  • 📝 Comprehensive logging and monitoring
  • 🚀 Easy integration with existing GORM applications

Installation

go get github.com/jongyunha/gorm-tx-manager

Quick Start

package main

import (
    "github.com/seoulrobotics/gorm-tx-manager"
    "gorm.io/gorm"
)

func main() {
    // Initialize your GORM database
    db := initDB()
    
    // Create transaction manager
    txManager := gormtx.NewTransactionManager(db)
    
    // Use transactional decorator
    userService := &UserService{db: db}
    txUserService := txManager.Transactional(userService)
    
    // Your transactional operations
    err := txUserService.CreateUser(user)
}

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published