Skip to content
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

Merged
merged 10 commits into from
May 30, 2019

Conversation

kilnerm
Copy link
Contributor

@kilnerm kilnerm commented May 21, 2019

This PR add a property to Model which allows the user to specify a chosen format for encoding any properties which are of type Date to their database.

The PR also updates the ORM to respect the value of the property when creating a table from a Model.

@kilnerm kilnerm requested a review from djones6 May 21, 2019 12:04
@kilnerm kilnerm self-assigned this May 21, 2019
@kilnerm kilnerm added this to the 2019.10 milestone May 21, 2019
@kilnerm kilnerm requested review from pushkarnk and removed request for djones6 May 28, 2019 11:00
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”

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?

@@ -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

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 ///

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 :)

Copy link

@pushkarnk pushkarnk left a 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.

@kilnerm kilnerm merged commit c909e0e into master May 30, 2019
@kilnerm kilnerm deleted the custom_encoding_property branch May 30, 2019 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants