This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Rohitha <rohitha.polamarasetty-intl@cylogic.com>
- Loading branch information
1 parent
7a377cf
commit 45de4b3
Showing
4 changed files
with
147 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package options | ||
|
||
// DagStatSettings is a set of Dag stat options. | ||
type DagStatSettings struct { | ||
Progress bool | ||
} | ||
|
||
// DagStatOption is a single Dag option. | ||
type DagStatOption func(opts *DagStatSettings) error | ||
|
||
// DagStatOptions applies the given option to a DagStatSettings instance. | ||
func DagStatOptions(opts ...DagStatOption) (*DagStatSettings, error) { | ||
options := &DagStatSettings{ | ||
Progress: false, | ||
} | ||
|
||
for _, opt := range opts { | ||
err := opt(options) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
|
||
return options, nil | ||
} | ||
|
||
// Progress is an option for Dag.Stat which returns progressive data while reading through the DAG | ||
func (dagOpts) Progress(progress bool) DagStatOption { | ||
return func(opts *DagStatSettings) error { | ||
opts.Progress = progress | ||
return nil | ||
} | ||
} |
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