New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds `.save(on:)` and `.delete(on:)` extensions to Future #371

merged 1 commit into from Feb 13, 2018


None yet
2 participants
Copy link

twof commented Feb 8, 2018

Saving and deleting models are very common operations. This PR adds two convenience methods for doing just that.

Example usage:

return Reservation
    .query(on: databaseConnectable)
    .filter(\Reservation.user == userName)
    .unwrap(or: Abort(.notFound, reason: "No reservations have been made"))
    .delete(on: databaseConnectable)
    .map(to: HTTPStatus.self) { _ in
        return .ok

@tanner0101 tanner0101 added this to the 3.0.0-beta.2 milestone Feb 13, 2018

@tanner0101 tanner0101 self-assigned this Feb 13, 2018

@tanner0101 tanner0101 merged commit 6901b0a into vapor:beta Feb 13, 2018

1 check passed

ci/circleci: linux Your tests passed on CircleCI!

This comment has been minimized.

Copy link

tanner0101 commented Feb 13, 2018

thanks :)

@twof twof deleted the twof:patch-1 branch Feb 13, 2018

@tanner0101 tanner0101 added this to Done in Vapor 3 Feb 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment