-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.go
81 lines (61 loc) · 1.04 KB
/
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
72
73
74
75
76
77
78
79
80
81
package gungnir
import (
"fmt"
)
type typePath interface {
Path() string
}
type createOneHandler interface {
CreateOne(c Ctx)
}
type createManyHandler interface {
CreateMany(c Ctx)
}
type readOneHandler interface {
ReadOne(c Ctx)
}
type readManyHandler interface {
ReadMany(c Ctx)
}
type deleteOneHandler interface {
DeleteOne(c Ctx)
}
type deleteManyHandler interface{
DeleteMany(c Ctx)
}
type updateOneHandler interface {
UpdateOne(c Ctx)
}
type updateManyHandler interface {
UpdateMany(c Ctx)
}
type optionsHandler interface {
OPTIONS(c Ctx)
}
type getHandler interface {
Get(c Ctx)
}
type GetCollectionHandler interface {
GetCollection(c Ctx)
}
type headHandler interface {
HEAD(c *Ctx)
}
type postHandler interface {
POST(c *Ctx)
}
type putHandler interface {
PUT(c *Ctx)
}
type patchHandler interface {
PATCH(c *Ctx)
}
type deleteHandler interface {
DELETE(c *Ctx)
}
func GetIDPath(name string) string {
return fmt.Sprintf(":%s_id", name)
}
func getCollectionPath(name string) string {
return fmt.Sprintf("%ss", name)
}