Files
marka/parser/blocks/codecs.go
2025-08-17 01:21:15 +02:00

31 lines
631 B
Go

package blocks
import "fmt"
// CodecType represents the type of codec used to encode/render a value
type CodecType string
const (
CodecText CodecType = "text"
CodecNumber CodecType = "number"
CodecYaml CodecType = "yaml"
CodecList CodecType = "list"
CodecConst CodecType = "const"
)
func parseCodecType(input string) (CodecType, error) {
switch input {
case "number":
return CodecNumber, nil
case "yaml":
return CodecYaml, nil
case "list":
return CodecList, nil
case "text":
return CodecText, nil
case "const":
return CodecConst, nil
}
return CodecText, fmt.Errorf("unknown codec: '%s'", input)
}