DatabaseDateComponents
public struct DatabaseDateComponents : DatabaseValueConvertible, StatementColumnConvertible, Codable
DatabaseDateComponents reads and stores DateComponents in the database.
-
The available formats for reading and storing date components.
See moreDeclaration
Swift
public enum Format : String
-
The date components
Declaration
Swift
public let dateComponents: DateComponents
-
The database format
Declaration
Swift
public let format: Format
-
Creates a DatabaseDateComponents from a DateComponents and a format.
Declaration
Swift
public init(_ dateComponents: DateComponents, format: Format)
Parameters
dateComponents
An optional DateComponents.
format
The format used for storing the date components in the database.
-
Returns a value initialized from a raw SQLite statement pointer.
Declaration
Swift
@inline(__always) @inlinable public init?(sqliteStatement: SQLiteStatement, index: Int32)
Parameters
sqliteStatement
A pointer to an SQLite statement.
index
The column index.
-
Returns a value that can be stored in the database.
Declaration
Swift
public var databaseValue: DatabaseValue { get }
-
Returns a DatabaseDateComponents if dbValue contains a valid date.
Declaration
Swift
public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> DatabaseDateComponents?
-
Creates a new instance by decoding from the given decoder.
Declaration
Swift
public init(from decoder: Decoder) throws
Parameters
decoder
The decoder to read data from.
-
Encodes this value into the given encoder.
Declaration
Swift
public func encode(to encoder: Encoder) throws
Parameters
encoder
The encoder to write data to.