Skip to content

Exposed SQL Datetime query condition #1021

Closed
@scalaenthu

Description

@scalaenthu

I have a table that has two fields of type Datetime and int.

    object DummyTable : IntIdTable("db.table", columnName = "id") {
        val createdAt = datetime("created_at")
        val mins = integer("mins")
        override val primaryKey = PrimaryKey(id)
    }

I have a function where i want to check the condition that createdAt plus mins is less than the Datetime now.

 fun isValid(id: String): Int? {
          return DummyTable.select{
              COND??
            }.single()[DummyTable.mins]
        }

Something like this:

DummyTable.createdAt plus minutes lessEq DateTime.now()??

Is there any method in exposed sql that can make it possible?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions