mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-05-19 18:58:03 +02:00
92053b85b0
* chore: update golangci-lint config and fix lint issues
26 lines
517 B
Go
26 lines
517 B
Go
package output
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
// formatter serializes rows to a writer. Unexported — only used by Writer.
|
|
type formatter interface {
|
|
format(w io.Writer, rows []row) error
|
|
ext() string
|
|
}
|
|
|
|
func newFormatter(name string) (formatter, error) {
|
|
switch name {
|
|
case "csv":
|
|
return &csvFormatter{}, nil
|
|
case "json":
|
|
return &jsonFormatter{}, nil
|
|
case "cookie-editor":
|
|
return &cookieEditorFormatter{fallback: &jsonFormatter{}}, nil
|
|
default:
|
|
return nil, fmt.Errorf("unsupported format: %s", name)
|
|
}
|
|
}
|