SQL 2.0.0
Protocols:
- The query structures this package exposes have been protocolized to allow for better support of custom SQL dialects. Instead of using concrete types like
struct
andenum
, this package now exposes protocols defining SQL capabilities. Specific SQL dialects can now create custom implementations of these protocols with additional stored properties or methods for supporting native functionality.
No serializers:
- Now that the query structures are protocolized, types can be responsible for serializing themselves. This greatly reduces the amount of code needed to serialize the SQL and keeps code organized.
New query builders:
- This package now exposes helpers for building the various SQL queries. This is a great way to build lower level queries without needing to resort to SQL strings.
let users = conn.select()
.all().from(User.self)
.where(\User.name == "Vapor")
.all(decoding: User.self)
print(users) // Future<[User]>
The above code would result in a SQL query like:
SELECT * FROM "users" WHERE "users"."name" = ?
See the updated documentation for more information:
docs.vapor.codes/3.0/sql/getting-started/
And of course, check out the API docs for detailed information about the public API:
api.vapor.codes/sql/latest/SQL/