repository.go
643 字节
package repository
import "sync"
//全局
var (
once sync.Once
User IUserRepository
UserAuth IUserAuthRepository
Commend ICommendRepository
Company ICompanyRepository
Department IDepartmentRepository
Position IPositionRepository
)
func init() {
InitRepository()
}
func InitRepository() {
User = &UserRepository{}
UserAuth = &UserAuthRepository{}
Commend = &CommendRepository{}
Company = &CompanyRepository{}
Department = &DepartmentRepository{}
Position = &PositionRepository{}
}
func InitRepositoryMock() {
once.Do(func() {
User = &UserMockRepository{}
UserAuth = &UserAuthMockRepository{}
})
}