-
Notifications
You must be signed in to change notification settings - Fork 0
/
enum_datatype.go
52 lines (40 loc) · 1.44 KB
/
enum_datatype.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
52
package flate
import (
"fmt"
"github.com/chronos-tachyon/enumhelper"
)
// DataType indicates the autodetected content type of the compressed data,
// text (ASCII-compatible, including ISO-8859-1 or UTF-8) vs binary (anything
// else).
type DataType byte
const (
// UnknownData indicates that autodetection was not performed.
UnknownData DataType = iota
// BinaryData indicates that autodetection found non-textual data.
BinaryData
// TextData indicates that autodetection found textual data.
TextData
)
var dataTypeData = []enumhelper.EnumData{
{GoName: "UnknownData", Name: "unknown"},
{GoName: "BinaryData", Name: "binary"},
{GoName: "TextData", Name: "text"},
}
// IsValid returns true if d is a valid DataType constant.
func (d DataType) IsValid() bool {
return d >= UnknownData && d <= TextData
}
// GoString returns the Go string representation of this DataType constant.
func (d DataType) GoString() string {
return enumhelper.DereferenceEnumData("DataType", dataTypeData, uint(d)).GoName
}
// String returns the string representation of this DataType constant.
func (d DataType) String() string {
return enumhelper.DereferenceEnumData("DataType", dataTypeData, uint(d)).Name
}
// MarshalJSON returns the JSON representation of this DataType constant.
func (d DataType) MarshalJSON() ([]byte, error) {
return enumhelper.MarshalEnumToJSON("DataType", dataTypeData, uint(d))
}
var _ fmt.GoStringer = DataType(0)
var _ fmt.Stringer = DataType(0)