-
Notifications
You must be signed in to change notification settings - Fork 0
/
enum_method.go
49 lines (38 loc) · 1.25 KB
/
enum_method.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
package flate
import (
"fmt"
"github.com/chronos-tachyon/enumhelper"
)
// Method indicates the compression method in use.
//
// Currently, only DEFLATE compression is supported.
//
type Method byte
const (
// DeflateMethod indicates that DEFLATE compression should be used.
DeflateMethod Method = iota
// DefaultMethod requests that the default Method be used, which is
// currently DeflateMethod.
DefaultMethod = DeflateMethod
)
var methodData = []enumhelper.EnumData{
{GoName: "DeflateMethod", Name: "deflate"},
}
// IsValid returns true if m is a valid Method constant.
func (m Method) IsValid() bool {
return m == DeflateMethod
}
// GoString returns the Go string representation of this Method constant.
func (m Method) GoString() string {
return enumhelper.DereferenceEnumData("Method", methodData, uint(m)).GoName
}
// String returns the string representation of this Method constant.
func (m Method) String() string {
return enumhelper.DereferenceEnumData("Method", methodData, uint(m)).Name
}
// MarshalJSON returns the JSON representation of this Method constant.
func (m Method) MarshalJSON() ([]byte, error) {
return enumhelper.MarshalEnumToJSON("Method", methodData, uint(m))
}
var _ fmt.GoStringer = Method(0)
var _ fmt.Stringer = Method(0)