定义仓库层对象
This commit is contained in:
25
internal/infra/repository/alarm_repository.go
Normal file
25
internal/infra/repository/alarm_repository.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// AlarmRepository 定义了对告警模型的数据库操作接口
|
||||
type AlarmRepository interface {
|
||||
}
|
||||
|
||||
// gormAlarmRepository 是 AlarmRepository 的 GORM 实现。
|
||||
type gormAlarmRepository struct {
|
||||
ctx context.Context
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
// NewGormAlarmRepository 创建一个新的 AlarmRepository GORM 实现实例。
|
||||
func NewGormAlarmRepository(ctx context.Context, db *gorm.DB) AlarmRepository {
|
||||
return &gormAlarmRepository{
|
||||
ctx: ctx,
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user