filhodanuvem / gitql

💊 A git query language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question: date query

vigo opened this issue · comments

First of all, I really liked this tool. Thanks for it... Can you please give some more date query examples ? between dates for instance? I cross checked via git's:

git log --online --since='4 months ago' --date=relative

and compared to git sql... It's like maximum 10 results for each query ?

Hello @vigo

Each date value can be represented with pattern Y-m-d H:i:s, for example:

# commits since Dec 1st
select author, message, date from commits where date >= '2016-12-01 00:00:00'
# range: commits in november
select author, message, date from commits where date >= '2016-11-01 00:00:00' and date < '2016-12-01 00:00:00'

You can use the reserved word limit to define how many lines you can see.

select author, message, date from commits where date >= '2016-11-01 00:00:00' and date < '2016-12-01 00:00:00' limit  20

If you think that our documentation could be better, we could work together to improve that. Let me know if want that.

By the way...
There is no way yet to define relative dates, but it would be a nice feature like mysql date_add

Thanks for answering... I had tried without H:i:s information. Now I understand the reason... One last thing, I guess the default limit value is 10... If I query like this:

select message,date from commits

I get 10 results... I think I need to set limit every time ?... Would be great if I can set a kind of env var something like GITQL_DEFAULT_LIMIT=100 (just an idea) :)

@vigo I tried

select author, message, date from commits where date >= '2016-11-01' and date < '2016-12-01' limit 20

And it works.
If you have some query using date in Y-m-d format and it does not work please can you open a new issue? So we can work on that.

Would be great if I can set a kind of env var something like GITQL_DEFAULT_LIMIT=100

I prefer to follow explicit is better than implicit but your ideia is cool. Feel free if you want send a PR ;)

ok, it works but if I don't provide "limit XX" default resuts are always 10... Here is the repo I make my tests. SQL is:

select author, message, date from commits where date >= '2016-01-01' and date < '2016-12-01'

I get 10 results unless I set limit XXX...

Right @vigo, as this issue was about that question with dates, I'm closing it and created another about the limit feature