Skip to content

Commit 2bd9b51

Browse files
committed
Add proper example to sequence docs
1 parent d3c26f9 commit 2bd9b51

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

lib/input/csv.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,13 @@ func NewCSVFile(conf Config, mgr types.Manager, log log.Modular, stats metrics.T
114114
}
115115

116116
path := pathsRemaining[0]
117+
handle, err := os.Open(path)
118+
if err != nil {
119+
return nil, err
120+
}
117121
pathsRemaining = pathsRemaining[1:]
118122

119-
return os.Open(path)
123+
return handle, nil
120124
},
121125
func(context.Context) {},
122126
optCSVSetComma(comma),

lib/input/sequence.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ must not be consumed in parallel.`,
3030
Footnotes: `
3131
## Examples
3232
33-
Read from three CSV files sequentially:
33+
A common use case might be to generate a message at the end of our main input:
3434
3535
` + "```yaml" + `
3636
input:
3737
sequence:
3838
inputs:
39-
- file:
40-
format: csv
41-
path: ./first.csv
42-
- file:
43-
format: csv
44-
path: ./second.csv
45-
- file:
46-
format: csv
47-
path: ./third.csv
48-
` + "```" + ``,
39+
- csv:
40+
paths: [ ./dataset.csv ]
41+
- bloblang:
42+
count: 1
43+
mapping: 'root = {"status":"finished"}'
44+
` + "```" + `
45+
46+
With this config once the records within ` + "`./dataset.csv`" + ` are exhausted
47+
our final payload ` + "`" + `{"status":"finished"}` + "`" + ` will be routed
48+
through the pipeline.`,
4949
sanitiseConfigFunc: func(conf Config) (interface{}, error) {
5050
inputsSanit := make([]interface{}, 0, len(conf.Sequence.Inputs))
5151
for _, in := range conf.Sequence.Inputs {

website/docs/components/inputs/sequence.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,20 @@ Default: `[]`
3939

4040
## Examples
4141

42-
Read from three CSV files sequentially:
42+
A common use case might be to generate a message at the end of our main input:
4343

4444
```yaml
4545
input:
4646
sequence:
4747
inputs:
48-
- file:
49-
format: csv
50-
path: ./first.csv
51-
- file:
52-
format: csv
53-
path: ./second.csv
54-
- file:
55-
format: csv
56-
path: ./third.csv
48+
- csv:
49+
paths: [ ./dataset.csv ]
50+
- bloblang:
51+
count: 1
52+
mapping: 'root = {"status":"finished"}'
5753
```
5854

55+
With this config once the records within `./dataset.csv` are exhausted
56+
our final payload `{"status":"finished"}` will be routed
57+
through the pipeline.
58+

0 commit comments

Comments
 (0)