transform: Add support for "format" option in transform.Unmarshal

Fixes #13887
This commit is contained in:
n1xx1
2025-08-05 22:19:51 +02:00
committed by GitHub
parent de4a7f1e04
commit ecc3dd1f53
3 changed files with 39 additions and 6 deletions

View File

@@ -36,6 +36,10 @@ import (
// Decoder provides some configuration options for the decoders.
type Decoder struct {
// Format specifies a specific format to decode from. If empty or
// unspecified, it's inferred from the contents or the filename.
Format string
// Delimiter is the field delimiter. Used in the CSV decoder. Default is
// ','.
Delimiter rune
@@ -57,6 +61,7 @@ type Decoder struct {
// OptionsKey is used in cache keys.
func (d Decoder) OptionsKey() string {
var sb strings.Builder
sb.WriteString(d.Format)
sb.WriteRune(d.Delimiter)
sb.WriteRune(d.Comment)
sb.WriteString(strconv.FormatBool(d.LazyQuotes))