| 1 | package parsingscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 5 | ) |
| 6 | |
| 7 | // Format represents a file format. |
| 8 | type Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format# string |
| 9 | |
| 10 | // NewReader creates a new reader for the format. |
| 11 | func (f Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#) NewReaderscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewReader().(options ReaderOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/ReaderOptions#) (Readerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Reader#, error) { |
| 12 | fn, ok := readersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/readers.[f] |
| 13 | if !ok { |
| 14 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("unsupported reader file format: %s", f) |
| 15 | } |
| 16 | return fn(options) |
| 17 | } |
| 18 | |
| 19 | // NewWriter creates a new writer for the format. |
| 20 | func (f Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#) NewWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#NewWriter().(options WriterOptionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/WriterOptions#) (Writerscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Writer#, error) { |
| 21 | fn, ok := writersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/writers.[f] |
| 22 | if !ok { |
| 23 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("unsupported writer file format: %s", f) |
| 24 | } |
| 25 | w, err := fn(options) |
| 26 | if err != nil { |
| 27 | return nil, err |
| 28 | } |
| 29 | return MultiDocumentWriterscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/MultiDocumentWriter().(w), nil |
| 30 | } |
| 31 | |
| 32 | // String returns the string representation of the format. |
| 33 | func (f Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#) Stringscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format#String().() string { |
| 34 | return string(f) |
| 35 | } |
| 36 | |
| 37 | // RegisteredReaders returns a list of registered readers. |
| 38 | func RegisteredReadersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/RegisteredReaders().() []Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format# { |
| 39 | var formats []Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format# |
| 40 | for format := range readersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/readers. { |
| 41 | formats = append(formats, format) |
| 42 | } |
| 43 | return formats |
| 44 | } |
| 45 | |
| 46 | // RegisteredWriters returns a list of registered writers. |
| 47 | func RegisteredWritersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/RegisteredWriters().() []Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format# { |
| 48 | var formats []Formatscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/Format# |
| 49 | for format := range writersscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/parsing`/writers. { |
| 50 | formats = append(formats, format) |
| 51 | } |
| 52 | return formats |
| 53 | } |