Hallucinate a whole lot of shit...

Too much shit...
This commit is contained in:
2025-10-10 22:28:05 +02:00
parent d7d3a6e888
commit da5133eef8
9 changed files with 233 additions and 42 deletions

30
repositories/base.go Normal file
View File

@@ -0,0 +1,30 @@
package repositories
import (
"gorm.io/gorm"
)
// BaseRepository provides common database operations
type BaseRepository struct {
db *gorm.DB
}
// NewBaseRepository creates a new base repository
func NewBaseRepository(db *gorm.DB) *BaseRepository {
return &BaseRepository{db: db}
}
// DB returns the underlying gorm.DB instance
func (r *BaseRepository) DB() *gorm.DB {
return r.db
}
// Raw executes raw SQL
func (r *BaseRepository) Raw(sql string, args ...any) *gorm.DB {
return r.db.Raw(sql, args...)
}
// AutoMigrate runs auto migration
func (r *BaseRepository) AutoMigrate(dst ...interface{}) error {
return r.db.AutoMigrate(dst...)
}