repository.go
373 字节
package repository
import "sync"
//全局
var (
once sync.Once
User IUserRepository
UserAuth IUserAuthRepository
)
func init() {
InitRepository()
}
func InitRepository() {
User = &UserRepository{}
UserAuth = &UserAuthRepository{}
}
func InitRepositoryMock() {
once.Do(func() {
User = &UserMockRepository{}
UserAuth = &UserAuthMockRepository{}
})
}