forked from gothinkster/golang-gin-realworld-example-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_handler.go
71 lines (45 loc) · 1.1 KB
/
user_handler.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
package main
type ID int
type UserAbstraction struct{
ProjectParticipation
GroupParticipation
InfoUser
ScoreInfoUser
}
type InfoUser struct{
Name string
Id ID
email string
}
type ScoreInfoUser struct{
Score int
}
type Participation struct{
Participants []ID
}
func (self *Participation) Contains (id ID) bool {
for _, v:= range self.Participants{
if ( v == id){
return true
}
}
return false
}
type ProjectParticipation struct{}
type GroupParticipation struct{}
//unusable function because cant return projects id
func GetParticipated( participantId ID, projects []Participation, answer *[]Participation){
AnswerId:= []Participation{}
for _, v := range projects{
result := v.Contains( participantId )
if( result!= false ) {
AnswerId = append( AnswerId, v)
}
}
(*answer) = AnswerId;
}
type HistoryStamps struct{
CreatedOn int64
LastModifiedOn int64
DeleteRequestOn int64
}