operator.go 575 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package lang
  2. // TODO: This logic is PostgreSQL-specific and needs to be refactored to support MySQL
  3. func IsComparisonOperator(s string) bool {
  4. switch s {
  5. case ">":
  6. case "<":
  7. case "<=":
  8. case ">=":
  9. case "=":
  10. case "<>":
  11. case "!=":
  12. default:
  13. return false
  14. }
  15. return true
  16. }
  17. func IsMathematicalOperator(s string) bool {
  18. switch s {
  19. case "+":
  20. case "-":
  21. case "*":
  22. case "/":
  23. case "%":
  24. case "^":
  25. case "|/":
  26. case "||/":
  27. case "!":
  28. case "!!":
  29. case "@":
  30. case "&":
  31. case "|":
  32. case "#":
  33. case "~":
  34. case "<<":
  35. case ">>":
  36. default:
  37. return false
  38. }
  39. return true
  40. }