-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from maxlaverse/data_source_with_filters
implement support for filters in data sources
- Loading branch information
Showing
17 changed files
with
365 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package bw | ||
|
||
type ListObjectsOption func(args *[]string) | ||
type ListObjectsOptionGenerator func(id string) ListObjectsOption | ||
|
||
func WithCollectionID(id string) ListObjectsOption { | ||
return func(args *[]string) { | ||
*args = append(*args, "--collectionid", id) | ||
} | ||
} | ||
|
||
func WithFolderID(id string) ListObjectsOption { | ||
return func(args *[]string) { | ||
*args = append(*args, "--folderid", id) | ||
} | ||
} | ||
|
||
func WithOrganizationID(id string) ListObjectsOption { | ||
return func(args *[]string) { | ||
*args = append(*args, "--organizationid", id) | ||
} | ||
} | ||
|
||
func WithSearch(search string) ListObjectsOption { | ||
return func(args *[]string) { | ||
*args = append(*args, "--search", search) | ||
} | ||
} | ||
|
||
func WithUrl(url string) ListObjectsOption { | ||
return func(args *[]string) { | ||
*args = append(*args, "--url", url) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package bw | ||
|
||
func FilterObjectsByType(objs []Object, itemType ItemType) []Object { | ||
if itemType == 0 { | ||
return objs | ||
} | ||
|
||
filtered := make([]Object, 0, len(objs)) | ||
for _, obj := range objs { | ||
if obj.Type == itemType { | ||
filtered = append(filtered, obj) | ||
} | ||
} | ||
return filtered | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.