(ctx context.Context, sctx *super.Context, path, format string, pushdown sbuf.Pushdown)
| 104 | } |
| 105 | |
| 106 | func (e *Environment) Open(ctx context.Context, sctx *super.Context, path, format string, pushdown sbuf.Pushdown) (sbuf.Puller, error) { |
| 107 | if path == "-" { |
| 108 | path = "stdio:stdin" |
| 109 | } |
| 110 | var fields []field.Path |
| 111 | if pushdown != nil { |
| 112 | if proj := pushdown.Projection(); proj != nil { |
| 113 | fields = proj.Paths() |
| 114 | } |
| 115 | } |
| 116 | file, err := anyio.Open(ctx, sctx, e.engine, path, e.readerOpts(fields, format)) |
| 117 | if err != nil { |
| 118 | return nil, fmt.Errorf("%s: %w", path, err) |
| 119 | } |
| 120 | scanner, err := sbuf.NewScanner(ctx, file, pushdown) |
| 121 | if err != nil { |
| 122 | file.Close() |
| 123 | return nil, err |
| 124 | } |
| 125 | return &closePuller{scanner, file}, nil |
| 126 | } |
| 127 | |
| 128 | func (e *Environment) readerOpts(fields []field.Path, format string) anyio.ReaderOpts { |
| 129 | o := e.ReaderOpts |
no test coverage detected