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

LimitFilter #6

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

LimitFilter #6

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

Comments

@wojteninho
Copy link
Owner

Say we want to filter first 100 files from a particular directory. I would love to do it as easy as:

s := NewBuilder().
     Files().
     In("/my/photos").
     Limit(100)    
     MustBuild()

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

Behind the scenes, it should be the new Scanner implementation called LimitScanner which is not a self-sufficient scanner, but act as a wrapper above the concrete scanner.

basicScanner := NewBasicScanner(WithDir("/my/photos"))
limitScanner := NewLimitScanner(basicScanner, 100)

To get familiar with the idea of wrappers check out available wrappers implementations.

Happy to see PR with this feature :-)

@wojteninho wojteninho added the good first issue Good for newcomers label Aug 11, 2018
@sargath sargath mentioned this issue Mar 19, 2020
3 tasks
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