-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference_enum.go
76 lines (68 loc) · 2.28 KB
/
reference_enum.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package malak
import (
"errors"
"fmt"
)
const (
// EntityTypeWorkspace is a EntityType of type workspace.
EntityTypeWorkspace EntityType = "workspace"
// EntityTypeInvoice is a EntityType of type invoice.
EntityTypeInvoice EntityType = "invoice"
// EntityTypeTeam is a EntityType of type team.
EntityTypeTeam EntityType = "team"
// EntityTypeInvite is a EntityType of type invite.
EntityTypeInvite EntityType = "invite"
// EntityTypeContact is a EntityType of type contact.
EntityTypeContact EntityType = "contact"
// EntityTypeDeck is a EntityType of type deck.
EntityTypeDeck EntityType = "deck"
// EntityTypeUpdate is a EntityType of type update.
EntityTypeUpdate EntityType = "update"
// EntityTypeLink is a EntityType of type link.
EntityTypeLink EntityType = "link"
// EntityTypeRoom is a EntityType of type room.
EntityTypeRoom EntityType = "room"
// EntityTypeRecipient is a EntityType of type recipient.
EntityTypeRecipient EntityType = "recipient"
// EntityTypeSchedule is a EntityType of type schedule.
EntityTypeSchedule EntityType = "schedule"
// EntityTypeList is a EntityType of type list.
EntityTypeList EntityType = "list"
)
var ErrInvalidEntityType = errors.New("not a valid EntityType")
// String implements the Stringer interface.
func (x EntityType) String() string {
return string(x)
}
// IsValid provides a quick way to determine if the typed value is
// part of the allowed enumerated values
func (x EntityType) IsValid() bool {
_, err := ParseEntityType(string(x))
return err == nil
}
var _EntityTypeValue = map[string]EntityType{
"workspace": EntityTypeWorkspace,
"invoice": EntityTypeInvoice,
"team": EntityTypeTeam,
"invite": EntityTypeInvite,
"contact": EntityTypeContact,
"deck": EntityTypeDeck,
"update": EntityTypeUpdate,
"link": EntityTypeLink,
"room": EntityTypeRoom,
"recipient": EntityTypeRecipient,
"schedule": EntityTypeSchedule,
"list": EntityTypeList,
}
// ParseEntityType attempts to convert a string to a EntityType.
func ParseEntityType(name string) (EntityType, error) {
if x, ok := _EntityTypeValue[name]; ok {
return x, nil
}
return EntityType(""), fmt.Errorf("%s is %w", name, ErrInvalidEntityType)
}