mirror of https://github.com/vapor/docs.git
make repository compile
This commit is contained in:
parent
56916fec70
commit
2c6b089bd9
|
|
@ -372,9 +372,9 @@ protocol UserRepository: ServiceType {
|
|||
}
|
||||
|
||||
final class MySQLUserRepository: UserRepository {
|
||||
let db: DatabaseConnectionPool<MySQLDatabase>
|
||||
let db: MySQLDatabase.ConnectionPool
|
||||
|
||||
init(_ db: DatabaseConnectionPool<MySQLDatabase>) {
|
||||
init(_ db: MySQLDatabase.ConnectionPool) {
|
||||
self.db = db
|
||||
}
|
||||
|
||||
|
|
@ -404,9 +404,13 @@ extension MySQLUserRepository {
|
|||
static let serviceSupports: [Any.Type] = [UserRepository.self]
|
||||
|
||||
static func makeService(for worker: Container) throws -> Self {
|
||||
return .init(worker.connectionPool(to: .mysql))
|
||||
return .init(try worker.connectionPool(to: .mysql))
|
||||
}
|
||||
}
|
||||
|
||||
extension Database {
|
||||
public typealias ConnectionPool = DatabaseConnectionPool<ConfiguredDatabase<Self>>
|
||||
}
|
||||
```
|
||||
|
||||
Then, in the controller:
|
||||
|
|
|
|||
Loading…
Reference in New Issue