-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.go
67 lines (54 loc) · 982 Bytes
/
models.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
package avatar
import (
"fmt"
"strings"
)
// Constants
type Gender int
const (
Male Gender = 1
Female Gender = 2
Both Gender = 3
)
type ColorType int
const (
Hex ColorType = 0
Definition ColorType = 1
)
type AvatarType int
const (
MALE AvatarType = 1
FEMALE AvatarType = 2
LETTER AvatarType = 3
STICKER AvatarType = 4
)
// Models
type Color struct {
Mode ColorType
Color string
}
func (c Color) validate(method string, field string) {
if c.Mode == Definition && !strings.Contains(c.Color, `id="{id}"`) {
panic(fmt.Sprintf(`[%s] definition color "%s" must contains id="{id}" placeholder attribute.`, method, field))
}
}
type paletteType struct {
shape Color
text Color
dress Color
dressShadow Color
decorator Color
}
type shapeType struct {
shape string
mask string
}
type hairColorType struct {
base Color
shadow Color
highlight Color
}
type skinColorType struct {
skin Color
shadow Color
}