cycle / database

Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders
MIT License
53 stars 22 forks source link

Adding support for `NOT` operator #185

Closed msmakouz closed 3 months ago

msmakouz commented 3 months ago

What's was changed

Support for the NOT operator in SQL queries has been added. To implement this functionality, new methods whereNot, andWhereNot, and orWhereNot have been added.

Examples:

$users = $database
    ->select('*')
    ->from('users')
    ->whereNot('status', 'blocked')
    ->fetchAll()

// SELECT * FROM `users` WHERE NOT `status` = 'blocked'
$users = $this->db()
    ->select('*')
    ->from('users')
    ->where('balance', '>', 0)
    ->andWhereNot('status', 'blocked')
    ->fetchAll();

// SELECT * FROM `users` WHERE `balance` > 0 AND NOT `status` = 'blocked'

Closes: #182

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.32%. Comparing base (1f5b226) to head (f76b187).

:exclamation: Current head f76b187 differs from pull request most recent head f1543f9. Consider uploading reports for the commit f1543f9 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## 2.x #185 +/- ## ============================================ + Coverage 95.29% 95.32% +0.03% - Complexity 1851 1856 +5 ============================================ Files 130 130 Lines 5099 5136 +37 ============================================ + Hits 4859 4896 +37 Misses 240 240 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.