-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact_enum.go
55 lines (47 loc) · 1.44 KB
/
contact_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
// Code generated by go-enum DO NOT EDIT.
// Version:
// Revision:
// Build Date:
// Built By:
package malak
import (
"errors"
"fmt"
)
const (
// ContactTitleMr is a ContactTitle of type mr.
ContactTitleMr ContactTitle = "mr"
// ContactTitleMrs is a ContactTitle of type mrs.
ContactTitleMrs ContactTitle = "mrs"
// ContactTitleMiss is a ContactTitle of type miss.
ContactTitleMiss ContactTitle = "miss"
// ContactTitleDoctor is a ContactTitle of type doctor.
ContactTitleDoctor ContactTitle = "doctor"
// ContactTitleChief is a ContactTitle of type chief.
ContactTitleChief ContactTitle = "chief"
)
var ErrInvalidContactTitle = errors.New("not a valid ContactTitle")
// String implements the Stringer interface.
func (x ContactTitle) 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 ContactTitle) IsValid() bool {
_, err := ParseContactTitle(string(x))
return err == nil
}
var _ContactTitleValue = map[string]ContactTitle{
"mr": ContactTitleMr,
"mrs": ContactTitleMrs,
"miss": ContactTitleMiss,
"doctor": ContactTitleDoctor,
"chief": ContactTitleChief,
}
// ParseContactTitle attempts to convert a string to a ContactTitle.
func ParseContactTitle(name string) (ContactTitle, error) {
if x, ok := _ContactTitleValue[name]; ok {
return x, nil
}
return ContactTitle(""), fmt.Errorf("%s is %w", name, ErrInvalidContactTitle)
}