Replies: 3 comments
-
I cannot reproduce: # run with bin/sequel -E sqlite:/
DB.create_table(:slots) do
primary_key :id
Time :from
Time :to
TrueClass :removed
end
class Slot < Sequel::Model(DB[:slots].where(removed: false))
end
t = Time.now
f = Time.now
Slot.where{ (from >= f) & (to < t) }.count.zero?
# SELECT count(*) AS 'count' FROM `slots`
# WHERE ((`removed` = 0) AND (`from` >= '2023-12-05 08:41:08.780932') AND (`to` < '2023-12-05 08:41:08.328756')) LIMIT 1 Can you please provide a self contained reproducible example? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks a lot for quick reply. As I was struggling with it a while I solved it immediately after asking for help. |
Beta Was this translation helpful? Give feedback.
0 replies
-
class Slot < Sequel::Model(DB[:slots].where(removed: false)) Very interesting line, writing down... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I noticed weird behavior which I can't workaround. I have following piece of code:
I am in control of
Slot
and beneath we haveSequel.model[:slots].where(removed: false)
. Context -self
is a Sequel::Model Slot instance (not stored in DB yet). Above in result gives such query:SELECT count(*) AS "count" FROM "slots" WHERE (("removed" IS FALSE) AND ("to" >= '2023-12-05 15:54:32.877326+0000')
As we see
from
parameter is missing - but not only that. Theto
parameter takes place offrom
...Sequel 5.73
Beta Was this translation helpful? Give feedback.
All reactions