A Spring Boot @Transactional
inspired transaction manager for GORM that provides declarative transaction management through function decorators.
- 🔄 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
go get github.com/jongyunha/gorm-tx-manager
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)
}
MIT License