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

Any support for column < than or > than? #41

Open
sctn4elk opened this issue Dec 10, 2024 · 1 comment
Open

Any support for column < than or > than? #41

sctn4elk opened this issue Dec 10, 2024 · 1 comment

Comments

@sctn4elk
Copy link

Using a json like this:

[
    {
        "id": 1,
        "from": "12/24/2024",
        "to": "12/25/2024",
        "prior": 7,
        "isAllDay": true,
        "title": "Closed for Christmas",
        "description": "This is a description of the event that has been added,.",
        "location": "Uptown",
        "group": "Group 1",
        "type": 1,
        "customTags": { 
            "closed": true
        }
    }
...
]

I am trying to select all of the current or future entries where the "from" date column is equal to a given date or greater than a given date, but I don't see a method for that in the where function. I need something like this:

$events = $json_db->select( '*' )
	->from( $fileName )
        ->where( [ 'from' == $date, 'from' > $date ], 'OR' )
	->get();

I tried something like this but it did not work:

->where(function($row) {
                        return $row['from'] >= $date;
                    })

Any methodology for that or do I need to code that myself?

@donjajo
Copy link
Owner

donjajo commented Dec 11, 2024

Hi @sctn4elk

There is no support for this at the moment. To cover more conditions around the where statement; passing a callable as argument to where() should be way to go!

I could try to implement this over the weekend. If you can do this, you can make a PR too.

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

No branches or pull requests

2 participants