GORM Storage
If you are already using GORM, this backend allows you to use any database supported by the ORM (PostgreSQL, MySQL, SQL Server, SQLite, etc.) without writing custom SQL.
import ( idempotencyGorm "github.com/fco-gt/gopotency/storage/gorm" "gorm.io/gorm")
// Pass your existing *gorm.DB connectionstore := idempotencyGorm.NewGormStorage(db)Database Migration
Section titled “Database Migration”GoPotency requires two tables: idempotency_records and idempotency_locks. You can automatically create them using GORM’s AutoMigrate:
db.AutoMigrate(&idempotencyGorm.IdempotencyRecord{}, &idempotencyGorm.IdempotencyLock{})Features
Section titled “Features”- Database Agnostic: Works with any platform supported by GORM.
- Transactional Support: Uses standard GORM mechanisms for storage operations.
- Easy Integration: Perfect for projects that already rely on GORM for their data layer.