23 lines
479 B
Go
23 lines
479 B
Go
package repository
|
|
|
|
import (
|
|
"cron_admin/app/models"
|
|
"xorm.io/xorm"
|
|
)
|
|
|
|
type UserRepo[P models.PO] struct {
|
|
repo *xorm.Session
|
|
CommonRepo ICommonRepo[P]
|
|
}
|
|
|
|
func NewUserRepo[P models.PO](repo *xorm.Session) *UserRepo[P] {
|
|
commonRepo := NewCommonRepo[P](repo)
|
|
return &UserRepo[P]{repo: repo, CommonRepo: commonRepo}
|
|
}
|
|
|
|
func (c *UserRepo[P]) WithByCustNo(custNo string) DBOption {
|
|
return func(g *xorm.Session) *xorm.Session {
|
|
return g.Where("custNo = ?", custNo)
|
|
}
|
|
}
|