mirror of
https://github.com/ctwj/urldb.git
synced 2025-11-25 03:15:04 +08:00
33 lines
715 B
Go
33 lines
715 B
Go
package repo
|
|
|
|
import (
|
|
"github.com/ctwj/panResManage/db/entity"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// PanRepository Pan的Repository接口
|
|
type PanRepository interface {
|
|
BaseRepository[entity.Pan]
|
|
FindWithCks() ([]entity.Pan, error)
|
|
}
|
|
|
|
// PanRepositoryImpl Pan的Repository实现
|
|
type PanRepositoryImpl struct {
|
|
BaseRepositoryImpl[entity.Pan]
|
|
}
|
|
|
|
// NewPanRepository 创建Pan Repository
|
|
func NewPanRepository(db *gorm.DB) PanRepository {
|
|
return &PanRepositoryImpl{
|
|
BaseRepositoryImpl: BaseRepositoryImpl[entity.Pan]{db: db},
|
|
}
|
|
}
|
|
|
|
// FindWithCks 查找包含Cks的Pan
|
|
func (r *PanRepositoryImpl) FindWithCks() ([]entity.Pan, error) {
|
|
var pans []entity.Pan
|
|
err := r.db.Preload("Cks").Find(&pans).Error
|
|
return pans, err
|
|
}
|