-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from vapor/pivots
improved pivots
- Loading branch information
Showing
66 changed files
with
1,399 additions
and
1,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ Packages | |
.build | ||
.DS_Store | ||
*.xcodeproj | ||
Package.pins | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,51 @@ | ||
/** | ||
A `Driver` execute queries | ||
and returns an array of results. | ||
It is responsible for interfacing | ||
with the data store powering Fluent. | ||
*/ | ||
/// A `Driver` execute queries | ||
/// and returns an array of results. | ||
/// It is responsible for interfacing | ||
/// with the data store powering Fluent. | ||
public protocol Driver: Executor { | ||
/** | ||
The string value for the | ||
default identifier key. | ||
The `idKey` will be used when | ||
`Model.find(_:)` or other find | ||
by identifier methods are used. | ||
This value is overriden by | ||
entities that implement the | ||
`Entity.idKey` static property. | ||
*/ | ||
/// The string value for the | ||
/// default identifier key. | ||
/// | ||
/// The `idKey` will be used when | ||
/// `Model.find(_:)` or other find | ||
/// by identifier methods are used. | ||
/// | ||
/// This value is overriden by | ||
/// entities that implement the | ||
/// `Entity.idKey` static property. | ||
var idKey: String { get } | ||
|
||
/** | ||
Creates a connection for executing | ||
queries. This method is used to | ||
automatically create a connection | ||
if any Executor methods are called on | ||
the Driver. | ||
*/ | ||
/// The default type for values stored against the identifier key. | ||
/// | ||
/// The `idType` will be accessed by those Entity implementations | ||
/// which do not themselves implement `Entity.idType`. | ||
var idType: IdentifierType { get } | ||
|
||
/// Creates a connection for executing | ||
/// queries. This method is used to | ||
/// automatically create a connection | ||
/// if any Executor methods are called on | ||
/// the Driver. | ||
func makeConnection() throws -> Connection | ||
} | ||
|
||
// MARK: Executor | ||
|
||
extension Driver { | ||
/// See Executor protocol. | ||
@discardableResult | ||
public func query<T: Entity>(_ query: Query<T>) throws -> Node { | ||
return try makeConnection().query(query) | ||
} | ||
|
||
|
||
/// See Executor protocol. | ||
public func schema(_ schema: Schema) throws { | ||
return try makeConnection().schema(schema) | ||
} | ||
|
||
|
||
/// See Executor protocol. | ||
@discardableResult | ||
public func raw(_ raw: String, _ values: [Node]) throws -> Node { | ||
return try makeConnection().raw(raw, values) | ||
} | ||
} | ||
|
||
|
||
// MARK: Deprecated | ||
|
||
enum DriverError: Error { | ||
case connectionsNotSupported(String) | ||
} | ||
|
||
extension Driver { | ||
public func makeConnection() throws -> Connection { | ||
throw DriverError.connectionsNotSupported("Please update your database driver package to be compatible with Fluent 1.4.") | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.