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 exact date query to enable logyesterday #96

Merged
merged 10 commits into from
May 21, 2023

Conversation

bkleinen
Copy link
Contributor

to be able to cleanly implement thingsapi/things-cli#9 an exact date match is needed in the api.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@mikez
Copy link
Contributor

mikez commented May 1, 2023

@bkleinen Thank you for the pull request and patience. :) My comments here relate to the files in things/*; @AlexanderWillner might comment on the workflows/tests.

I like the proposal, and want to offer a slight tweak. Instead of doing exact=, I'd suggest to use the following syntax:

  • stop_date="=2023-05-01"
  • stop_date="<=2023-05-01"
  • stop_date=">=2023-05-01"

Without the comparator-prefix, the defaults could then always be ">=":

  • start_date="2023-05-01" (same as ">=2023-05-01")
  • stop_date="2023-05-01" (same as ">=2023-05-01")
  • deadline="2023-05-01" (same as ">=2023-05-01")

@mikez mikez mentioned this pull request May 1, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@AlexanderWillner AlexanderWillner merged commit 13e48c4 into thingsapi:main May 21, 2023
mikez added a commit that referenced this pull request May 22, 2023
start_date, stop_date, and deadline parameters now allow to pass
ISO 8601 dates with an optional operator. The input is converted
to a "Things date" integer prior to running the SQL statement
if it such a date column; otherwise regular UNIX Time is used.

Examples:

'2023-05-22'
'<=2023-05-22'
'>2023-05-22'

In SQL, depending on its column type, the parameter '<2023-05-22'
is converted into

    deadline < 132602624

or

    date(stopDate, 'unixepoch') < date('2023-05-22')

See also: #96 and thingsapi/things-cli#9
@mikez
Copy link
Contributor

mikez commented May 22, 2023

Follow-up: Implemented this syntax but chose no operator to mean exact match, so stop_date="2023-05-01" is the same as stop_date="=2023-05-01" or stop_date="==2023-05-01"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants