-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add property to set encoding format for Date
properties.
#110
Conversation
README.md
Outdated
|
||
You can change this behaviour by overriding the default value of the property `dateEncodingStrategy`. The dateEncodingStrategy will apply to all Date properties on your Model. | ||
|
||
The example below defines a model which will have its Date properties encoded and decoded as a timestamp” |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ” at the end of this line looks like a typo?
Sources/SwiftKueryORM/Model.swift
Outdated
@@ -19,6 +19,18 @@ import KituraContracts | |||
import Foundation | |||
import Dispatch | |||
|
|||
/// Defines the supported formats for persisiting properties of type `Date`. | |||
public enum DateEncodingFormat { | |||
// time - Corresponds to the `time` column type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we intend to have these comments (describing each case) to be a part of the API docs, they'd need to start with ///
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think we must document these in the API docs :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We seem to be adding support for the common date/time SQL types. Overall, this implementation looks good to me. I just have some feedback around doc comments.
This PR add a property to
Model
which allows the user to specify a chosen format for encoding any properties which are of typeDate
to their database.The PR also updates the ORM to respect the value of the property when creating a table from a Model.