rem

operator fun <T> KQLiteColumn<T>.rem(column: KQLiteColumn<out T>): KQLiteColumn<T>

Represents the SQL % (modulo) operator between two columns.

This operator function calculates the remainder of the division between two KQLiteColumn instances, which translates to column1 % column2 in the generated SQL. It is useful for finding the remainder after integer division.

Example

// SELECT (Products.stock % Products.base) AS "remainder_stock" FROM Products
Products.select(
(Products.stock % Products.base) AS "remainder_stock"
)

Return

A new KQLiteColumn representing the result of the modulo expression.

Author

MOHAMMAD AZIM ANSARI

Parameters

column

The divisor KQLiteColumn (the right-hand side of the modulo operation).

See also


operator fun <T> KQLiteColumn<T>.rem(literal: T): KQLiteColumn<T>

Represents the SQL % (modulo) operator between a column and a literal value.

This operator function calculates the remainder of the division of a KQLiteColumn by a literal value, which translates to column % value in the generated SQL. This is useful for tasks such as checking for even/odd numbers or distributing items into batches.

Example

// SELECT (Employees.employeeId % 2) AS "is_odd" FROM Employees
Employees.select(
(Employees.employeeId % 2) AS "is_odd"
)

Return

A new KQLiteColumn representing the result of the modulo expression.

Author

MOHAMMAD AZIM ANSARI

Parameters

literal

The literal value to use as the divisor.

See also