(solved) Hi, im having a problem with BETWEEN<Loca...
# squarelibraries
a
(solved) Hi, im having a problem with BETWEENLocalDate statements in sqldelight
1
I defined the a database entity like so:
Copy code
import kotlin.Boolean;
import <http://kotlin.Int|kotlin.Int>;
import kotlinx.datetime.LocalDate;

CREATE TABLE IF NOT EXISTS master_schedule(
    id INTEGER AS Int NOT NULL,
    master_id INTEGER AS Int NOT NULL,
    date TEXT AS LocalDate NOT NULL,
    is_deleted INTEGER AS Boolean NOT NULL,
    PRIMARY KEY(id)
);

findWorkingMaster:
SELECT * FROM master_schedule
WHERE master_id = :masterId AND date BETWEEN :fromDate AND :toDate AND is_deleted = 0
ORDER BY date;
that translates to
Copy code
public fun <T : Any> findWorkingMaster(
  masterId: Int,
  fromDate: LocalDate,
  toDate: LocalDate,
  mapper: (
    id: Int,
    master_id: Int,
    date: LocalDate,
    is_deleted: Boolean,
  ) -> T,
): Query<T> = FindWorkingMasterQuery(masterId, fromDate, toDate) { cursor ->
  mapper(
    master_scheduleAdapter.idAdapter.decode(cursor.getLong(0)!!),
    master_scheduleAdapter.master_idAdapter.decode(cursor.getLong(1)!!),
    master_scheduleAdapter.dateAdapter.decode(cursor.getString(2)!!),
    cursor.getBoolean(3)!!
  )
}
but whenever I try to run the code, it changes to
Copy code
public fun <T : Any> findWorkingMaster(
  masterId: Int,
  fromDate: Boolean,
  toDate: Boolean,
  mapper: (
    id: Int,
    master_id: Int,
    date: LocalDate,
    is_deleted: Boolean,
  ) -> T,
): Query<T> = FindWorkingMasterQuery(masterId, fromDate, toDate) { cursor ->
  mapper(
    master_scheduleAdapter.idAdapter.decode(cursor.getLong(0)!!),
    master_scheduleAdapter.master_idAdapter.decode(cursor.getLong(1)!!),
    master_scheduleAdapter.dateAdapter.decode(cursor.getString(2)!!),
    cursor.getBoolean(3)!!
  )
}
and suddenly the date range becomes Boolean range. Does somebody know what is a possible reason?
IMAGE 2024-02-14 202200.jpg,IMAGE 2024-02-14 202212.jpg,IMAGE 2024-02-14 202214.jpg
nevermind guys, updated to version 2.0.1 and the error went away
👍 1