-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
compression_type_gen.go
51 lines (41 loc) · 1.5 KB
/
compression_type_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Code generated by "enumer -type=CompressionType -transform=snake -trimprefix CompressionType -output compression_type_gen.go"; DO NOT EDIT.
package httpext
import (
"fmt"
)
const _CompressionTypeName = "gzipdeflatezstdbr"
var _CompressionTypeIndex = [...]uint8{0, 4, 11, 15, 17}
func (i CompressionType) String() string {
if i >= CompressionType(len(_CompressionTypeIndex)-1) {
return fmt.Sprintf("CompressionType(%d)", i)
}
return _CompressionTypeName[_CompressionTypeIndex[i]:_CompressionTypeIndex[i+1]]
}
var _CompressionTypeValues = []CompressionType{0, 1, 2, 3}
var _CompressionTypeNameToValueMap = map[string]CompressionType{
_CompressionTypeName[0:4]: 0,
_CompressionTypeName[4:11]: 1,
_CompressionTypeName[11:15]: 2,
_CompressionTypeName[15:17]: 3,
}
// CompressionTypeString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func CompressionTypeString(s string) (CompressionType, error) {
if val, ok := _CompressionTypeNameToValueMap[s]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to CompressionType values", s)
}
// CompressionTypeValues returns all values of the enum
func CompressionTypeValues() []CompressionType {
return _CompressionTypeValues
}
// IsACompressionType returns "true" if the value is listed in the enum definition. "false" otherwise
func (i CompressionType) IsACompressionType() bool {
for _, v := range _CompressionTypeValues {
if i == v {
return true
}
}
return false
}