You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I was wondering if it would make sense to update the type for Connection.userVersion and make it a non optional.
It seems like the default value for userVersion is 0, this can potentially be a source of confusion.
Since value is an Optional, one could assume that the default value would be nil.
Example Code
let userVersion = try! Connection(".../myDB.sqlite3").userVersion
print(userVersion) // Optional(0)
Proposed Change
/// The user version of the database.
/// See SQLite [PRAGMA user_version](https://sqlite.org/pragma.html#pragma_user_version)
///
/// Defaults to 0.
var userVersion: UserVersion {
get {
(try? scalar("PRAGMA user_version") as? Int64).map(Int32.init) ?? 0
}
set {
_ = try? run("PRAGMA user_version = \(newValue ?? 0)")
}
}
I would be happy to create a pull request if this change make sense, thank you 🙇
The text was updated successfully, but these errors were encountered:
Hello, I was wondering if it would make sense to update the type for
Connection.userVersion
and make it a non optional.It seems like the default value for
userVersion
is0
, this can potentially be a source of confusion.Since value is an
Optional
, one could assume that the default value would benil
.Example Code
Proposed Change
I would be happy to create a pull request if this change make sense, thank you 🙇
The text was updated successfully, but these errors were encountered: