SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

Non-optional date functions?

Open sharplet opened this issue 7 years ago • 3 comments

I'd like to be able to write the following:

let creationTime = Expression<Date>("created_at")
try db.run(foo.create { t in
  // ...
  t.column(creationTime, defaultValue: DateFunctions.datetime("now"))
})

But currently this doesn't work because the various date functions return Expression<Date?>, rather than Expression<Date>. Is it possible to get a non-optional version of the now() function?

sharplet avatar Apr 23 '18 14:04 sharplet

Any update on this? I am getting the same error when t.column(created, defaultValue: DateFunctions.datetime("now"))

exim13 avatar Jul 01 '18 01:07 exim13

Hey guys,

Did you find a solution to this error?

lucascorrea avatar Aug 01 '18 13:08 lucascorrea

So there should be a DateFunctions.now returning Expression<Date>?

jberkel avatar Aug 25 '21 10:08 jberkel