module Rotor::Compare

The comparisons a query's block may write on a nullable column: User.where { age > 18 } with age an Int?. Every query block (where, filter, a join's condition, order, update, preload, select) is checked with using Rotor::Compare (Quarz's docs/01 §7), so nil compares false there, as SQL's NULL acts in a condition; the translator gives them SQL's comparison, which can be NULL, and refuses them where NULL and false differ (under !, as a value). Outside query blocks Int? > Int is still a type error. Only <, <=, > and >=: nil has no arithmetic, and ==/!= are Quarz's own.

class CUser < Rotor::Model
  table "users" do
    column :id, Int, primary: true
    column :age, Int, null: true
  end
end

CUser.where { age > 18 }.to_sql  # => ["SELECT \"id\", \"age\" FROM \"users\" WHERE \"age\" > 18", []]
CUser.where { !(age > 18) }      # raises Rotor::UntranslatableError

/home/runner/work/rotor/rotor/src/compare.qz:22

Extensions

def <(other: Object) -> Bool

in extension Nil

/home/runner/work/rotor/rotor/src/compare.qz:25

def <=(other: Object) -> Bool

in extension Nil

/home/runner/work/rotor/rotor/src/compare.qz:26

def >(other: Object) -> Bool

in extension Nil

/home/runner/work/rotor/rotor/src/compare.qz:27

def >=(other: Object) -> Bool

in extension Nil

/home/runner/work/rotor/rotor/src/compare.qz:28

def <(other: Int | Float | Nil) -> Bool

in extension Int

Whether the receiver is less than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:36

def <=(other: Int | Float | Nil) -> Bool

in extension Int

Whether the receiver is less than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:43

def >(other: Int | Float | Nil) -> Bool

in extension Int

Whether the receiver is greater than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:50

def >=(other: Int | Float | Nil) -> Bool

in extension Int

Whether the receiver is greater than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:57

def <(other: Int | Float | Nil) -> Bool

in extension Float

Whether the receiver is less than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:68

def <=(other: Int | Float | Nil) -> Bool

in extension Float

Whether the receiver is less than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:75

def >(other: Int | Float | Nil) -> Bool

in extension Float

Whether the receiver is greater than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:82

def >=(other: Int | Float | Nil) -> Bool

in extension Float

Whether the receiver is greater than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:89

def <(other: String?) -> Bool

in extension String

Whether the receiver is less than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:100

def <=(other: String?) -> Bool

in extension String

Whether the receiver is less than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:101

def >(other: String?) -> Bool

in extension String

Whether the receiver is greater than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:102

def >=(other: String?) -> Bool

in extension String

Whether the receiver is greater than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:103

def <(other: Time?) -> Bool

in extension Time

Whether the receiver is less than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:108

def <=(other: Time?) -> Bool

in extension Time

Whether the receiver is less than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:109

def >(other: Time?) -> Bool

in extension Time

Whether the receiver is greater than other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:110

def >=(other: Time?) -> Bool

in extension Time

Whether the receiver is greater than or equal to other.

from Comparable

/home/runner/work/rotor/rotor/src/compare.qz:111