From edbd2e8d016df6c6ad996392b16a133a863e2d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Jul 2015 16:30:36 +0200 Subject: [PATCH] Minor tweaks --- GRDB Tests/GRDBTests.swift | 7 +++++-- README.md | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/GRDB Tests/GRDBTests.swift b/GRDB Tests/GRDBTests.swift index 8693ddcd7..5272fb063 100644 --- a/GRDB Tests/GRDBTests.swift +++ b/GRDB Tests/GRDBTests.swift @@ -10,6 +10,9 @@ import XCTest import GRDB struct DatabaseDate: SQLiteValueConvertible { + + // MARK: - DatabaseDate <-> NSDate conversion + let date: NSDate // Define a failable initializer in order to consistently use nil as the @@ -22,12 +25,12 @@ struct DatabaseDate: SQLiteValueConvertible { } } - // Date -> SQLite + // MARK: - DatabaseDate <-> SQLiteValue conversion + var sqliteValue: SQLiteValue { return .Real(date.timeIntervalSince1970) } - // SQLite -> Date init?(sqliteValue: SQLiteValue) { // Don't handle the raw SQLiteValue unless you know what you do. // It is recommended to use GRDB built-in conversions instead: diff --git a/README.md b/README.md index 06e195954..622334dd1 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,9 @@ For example, let's define below the `DatabaseDate` type that stores and loads NS ```swift struct DatabaseDate: SQLiteValueConvertible { + + // MARK: - DatabaseDate <-> NSDate conversion + let date: NSDate // Define a failable initializer in order to consistently use nil as the @@ -250,12 +253,12 @@ struct DatabaseDate: SQLiteValueConvertible { } } - // Date -> SQLite + // MARK: - DatabaseDate <-> SQLiteValue conversion + var sqliteValue: SQLiteValue { return .Real(date.timeIntervalSince1970) } - // SQLite -> Date init?(sqliteValue: SQLiteValue) { // Don't handle the raw SQLiteValue unless you know what you do. // It is recommended to use GRDB built-in conversions instead: