1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-20 16:59:17 +08:00
1Panel/core/app/repo/common.go

23 lines
366 B
Go
Raw Normal View History

2024-07-19 19:04:11 +08:00
package repo
import (
"gorm.io/gorm"
)
type DBOption func(*gorm.DB) *gorm.DB
type ICommonRepo interface {
WithOrderBy(orderStr string) DBOption
}
type CommonRepo struct{}
func NewCommonRepo() ICommonRepo {
return &CommonRepo{}
}
func (c *CommonRepo) WithOrderBy(orderStr string) DBOption {
return func(g *gorm.DB) *gorm.DB {
return g.Order(orderStr)
}
}