我有当前表:
create table Tokens (
token varchar(256) not null,
duser varchar(32) not null,
type varchar(16) not null,
expires_in datetime not null,
auth_time datetime not null,
primary key(token),
foreign key(duser) references User(id)
);
,我想在下面进行查询:
select * from Tokens where duser = "myid" and expires_in > current_timestamp
--or something to compare if expires_in is greater than the current date **and** time
但是我正在使用Exposed。我已经做到了:
return transaction {
Database.TOKENS.run {
select {
(user eq this@DogoUser.id) and (expiresIn greater) //stopped here
}
}
}
如何通过Jetbrains暴露current_timestamp
MySQL变量?
答案 0 :(得分:0)
为此,在Exposed中有CurrentDateTime表达式。
select {
(user eq this@DogoUser.id) and (expiresIn.greater(CurrentDateTime())
}