Skip to content
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

Support all of MySQL's comparison operators #6

Open
p810 opened this issue Nov 12, 2019 · 1 comment
Open

Support all of MySQL's comparison operators #6

p810 opened this issue Nov 12, 2019 · 1 comment

Comments

@p810
Copy link
Owner

p810 commented Nov 12, 2019

p810\MySQL\Builder\Grammar\Where and p810\MySQL\Builder\Grammar\Join currently only support a small subset of the possible comparison operators that MySQL provides. This effort will be to implement the remaining operators as methods of either trait, and add test cases for each.

p810\MySQL\Builder\Grammar\Where

Methods
whereNotLike()
orWhereNotLike()
whereBetween() [1]
orWhereBetween()
whereNotBetween()
orWhereNotBetween()
whereIs()
orWhereIs()
whereIsNot()
orWhereIsNot()
whereIsNull()
orWhereIsNull()
whereIsNotNull()
orWhereIsNotNull()
whereGreatest()
orWhereGreatest()
whereLeast()
orWhereLeast()
whereInterval()
orWhereInterval()
whereCoalesce()
orWhereCoalesce()
whereNullSafeEquals() [2]
orWhereNullSafeEquals()

[1] This method, whereNotBetween(), and their or* aliases, will also have *Many() variants that support lists of BETWEEN or NOT BETWEEN queries.

[2] This method and its or* alias will have aliases named whereNullSafe() and orWhereNullSafe() for API consistency, since the default operator with where() is the non-null safe equals (=)

p810\MySQL\Builder\Grammar\Join

Methods
onLess()
orOnLess()
onLessOrEqual()
orOnLessOrEqual()
onGreater()
orOnGreater()
onGreaterOrEqual()
orOnGreaterOrEqual()
onLike()
orOnLike()
onNotEquals() [1]
orOnNotEquals()
onNotLike()
orOnNotLike()
onBetween()
orOnBetween()
onNotBetween()
orOnNotBetween()
onIs()
orOnIs()
onIsNot()
orOnIsNot()
onIsNull()
orOnIsNull()
onIsNotNull()
orOnIsNotNull()
onGreatest()
orOnGreatest()
onLeast()
orOnLeast()
onInterval()
orOnInterval()
onCoalesce()
orOnCoalesce()
onNullSafeEquals() [2]
orOnNullSafeEquals()

[1] This will also include onNot() and orOnNot() for consistency with the API provided by p810\MySQL\Builder\Grammar\Where.

[2] This method and its or* alias will have aliases named onNullSafe() and orOnNullSafe() for API consistency, since the default operator with on() is the non-null safe equals (=)

@p810 p810 created this issue from a note in mysql-helper (Planned) Nov 12, 2019
@p810 p810 moved this from Planned to In Progress in mysql-helper Dec 8, 2019
@p810
Copy link
Owner Author

p810 commented Dec 8, 2019

Updated the list with a couple changes:

  1. Comparison functions like GREATEST() will be implemented as their own standalone functions in the top level of the project's namespace (e.g. p810\MySQL\greatest()) since these are not specifically operators used in queries. They could be manually written into a clause but I like the thought of having helpers for certain functions, which make sense in a query builder since the goal is bringing the writing of SQL queries closer to the language.

  2. The *Many() variants have been scrapped since they represent an uncommon use case and introduce a level of complexity that's unnecessary when they can easily be written using helper methods like commas() or just by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
mysql-helper
  
In Progress
Development

No branches or pull requests

1 participant