Last active
November 4, 2021 10:41
-
-
Save hugithordarson/c97ec7b15b29db8912506db75af9f412 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void performFetch() { | |
addDateTruncAttribute( editingContext, "SomeEntity", "checkInTimeTruncated", "check_in_time" ); | |
addDateTruncAttribute( editingContext, "SomeEntity", "requestedTruncated", "requested" ); | |
EOQualifier q = EOQualifier.qualifierWithQualifierFormat( "checkInTimeTruncated>=requestedTruncated", null ); | |
// ...finish your fetch using the qualifier | |
} | |
static void addDateTruncAttribute( EOEditingContext ec, String entityName, String attributeName, String columnName ) { | |
EOAttribute attribute = new EOAttribute(); | |
attribute.setName( attributeName ); | |
attribute.setColumnName( columnName ); | |
attribute.setReadFormat( "date_trunc('day',%P)" ); | |
EOUtilities.entityNamed( ec, entityName ).addAttribute( attribute ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment