-
Notifications
You must be signed in to change notification settings - Fork 6
/
role.go
51 lines (41 loc) · 781 Bytes
/
role.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
package entities
import "github.com/sasha-s/go-deadlock"
type Role struct {
deadlock.RWMutex
Name string `json:"Name"`
ID string `json:"ID"`
Position int `json:"Position"`
}
func NewRole(name string, ID string, position int) Role {
return Role{Name: name, ID: ID, Position: position}
}
func (r Role) SetName(name string) Role {
r.Name = name
return r
}
func (r Role) GetName() string {
if r == (Role{}) {
return ""
}
return r.Name
}
func (r Role) SetID(id string) Role {
r.ID = id
return r
}
func (r Role) GetID() string {
if r == (Role{}) {
return ""
}
return r.ID
}
func (r Role) SetPosition(position int) Role {
r.Position = position
return r
}
func (r Role) GetPosition() int {
if r == (Role{}) {
return 0
}
return r.Position
}