vapor-community / postgresql

Robust PostgreSQL interface for Swift
MIT License
131 stars 33 forks source link

Add support for LISTEN and NOTIFY #28

Closed johnbona closed 7 years ago

johnbona commented 7 years ago

I'm not all that comfortable with libpq so give this extra scrutiny. πŸ™Š

I used this example heavily to help me determine how to receive notifications using libpq. I also purposefully broke convention and used a closure in listen instead of creating a onNotification property off Database since a database could be listening to multiple channels simultaneously.

Couple of things that I wanted to point out for feedback:

codecov-io commented 7 years ago

Codecov Report

Merging #28 into master will increase coverage by 0.01%. The diff coverage is 93.75%.

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   93.36%   93.37%   +0.01%     
==========================================
  Files          11       12       +1     
  Lines        1748     1812      +64     
==========================================
+ Hits         1632     1692      +60     
- Misses        116      120       +4
Impacted Files Coverage Ξ”
Sources/PostgreSQL/Notification.swift 100% <100%> (ΓΈ)
Tests/PostgreSQLTests/PostgreSQLTests.swift 95.72% <100%> (+0.22%) :white_check_mark:
Sources/PostgreSQL/Database.swift 89.13% <85.71%> (-1.5%) :x:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update c9c0c3a...d95fef7. Read the comment docs.

johnbona commented 7 years ago

Not sure what happened there so recreated the PR. πŸ˜