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

ModifiedFilter #5

Open
wojteninho opened this issue Aug 11, 2018 · 0 comments
Open

ModifiedFilter #5

wojteninho opened this issue Aug 11, 2018 · 0 comments
Labels
good first issue Good for newcomers

Comments

@wojteninho
Copy link
Owner

What I have in my mind is to have an easy way to filter out files by modification date.
Say for instance we want to filter out files modified since yesterday:

yesterday := time.Now().AddDate(0, 0, -1)

s := NewBuilder().
     Files().
     In("/my/photos").
     Modified(After(yesterday))    
     MustBuild()

for item := range MustScan(s.Scan(context.TODO())) {
    ...
}

Another example is:

yesterday := time.Now().AddDate(0, 0, -1)

s := NewBuilder().
     Files().
     In("/my/photos").
     Modified(Before(yesterday))    
     MustBuild()

One more could be the between two dates:

twoDaysAgo := time.Now().AddDate(0, 0, -2)
yesterday := time.Now().AddDate(0, 0, -1)

s := NewBuilder().
     Files().
     In("/my/photos").
     Modified(Between(twoDaysAgo, yesterday))    
     MustBuild()

Behind the scenes it should be the new implementation of Filter interface, and in the builder calling Modified(...) we should add one more filter.

Check how we eventually combine multiple filters here. Filters comes so far from calls to either Files() or Directories() or Match(...).

Happy to discuss further 😄 👍

@wojteninho wojteninho added the good first issue Good for newcomers label Aug 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant