Files
native/compression_enum.go
zeekay 765c3d0aa1 hanzo-ds/native: de-branded native protocol lib (fork of clickhouse ch-go v0.71.0)
Module path, package names, and identifiers de-branded to native/proto/compress/
pool/tracing. Server wire-protocol strings preserved. Vendored codec surface used
by hanzo-ds/go (proto + compress).
2026-07-10 13:10:07 -07:00

91 lines
2.7 KiB
Go

// Code generated by "enumer -transform upper -type Compression -trimprefix Compression -output compression_enum.go"; DO NOT EDIT.
package native
import (
"fmt"
"strings"
)
const _CompressionName = "DISABLEDLZ4ZSTDNONELZ4HC"
var _CompressionIndex = [...]uint8{0, 8, 11, 15, 19, 24}
const _CompressionLowerName = "disabledlz4zstdnonelz4hc"
func (i Compression) String() string {
if i >= Compression(len(_CompressionIndex)-1) {
return fmt.Sprintf("Compression(%d)", i)
}
return _CompressionName[_CompressionIndex[i]:_CompressionIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _CompressionNoOp() {
var x [1]struct{}
_ = x[CompressionDisabled-(0)]
_ = x[CompressionLZ4-(1)]
_ = x[CompressionZSTD-(2)]
_ = x[CompressionNone-(3)]
_ = x[CompressionLZ4HC-(4)]
}
var _CompressionValues = []Compression{CompressionDisabled, CompressionLZ4, CompressionZSTD, CompressionNone, CompressionLZ4HC}
var _CompressionNameToValueMap = map[string]Compression{
_CompressionName[0:8]: CompressionDisabled,
_CompressionLowerName[0:8]: CompressionDisabled,
_CompressionName[8:11]: CompressionLZ4,
_CompressionLowerName[8:11]: CompressionLZ4,
_CompressionName[11:15]: CompressionZSTD,
_CompressionLowerName[11:15]: CompressionZSTD,
_CompressionName[15:19]: CompressionNone,
_CompressionLowerName[15:19]: CompressionNone,
_CompressionName[19:24]: CompressionLZ4HC,
_CompressionLowerName[19:24]: CompressionLZ4HC,
}
var _CompressionNames = []string{
_CompressionName[0:8],
_CompressionName[8:11],
_CompressionName[11:15],
_CompressionName[15:19],
_CompressionName[19:24],
}
// CompressionString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func CompressionString(s string) (Compression, error) {
if val, ok := _CompressionNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _CompressionNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to Compression values", s)
}
// CompressionValues returns all values of the enum
func CompressionValues() []Compression {
return _CompressionValues
}
// CompressionStrings returns a slice of all String values of the enum
func CompressionStrings() []string {
strs := make([]string, len(_CompressionNames))
copy(strs, _CompressionNames)
return strs
}
// IsACompression returns "true" if the value is listed in the enum definition. "false" otherwise
func (i Compression) IsACompression() bool {
for _, v := range _CompressionValues {
if i == v {
return true
}
}
return false
}