/
hook.go
76 lines (49 loc) · 1.97 KB
/
hook.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
package schema
import (
"context"
"reflect"
)
type BeforeScanHook interface {
BeforeScan(context.Context) error
}
var beforeScanHookType = reflect.TypeOf((*BeforeScanHook)(nil)).Elem()
//------------------------------------------------------------------------------
type AfterScanHook interface {
AfterScan(context.Context) error
}
var afterScanHookType = reflect.TypeOf((*AfterScanHook)(nil)).Elem()
//------------------------------------------------------------------------------
type AfterSelectHook interface {
AfterSelect(context.Context) error
}
var afterSelectHookType = reflect.TypeOf((*AfterSelectHook)(nil)).Elem()
//------------------------------------------------------------------------------
type BeforeInsertHook interface {
BeforeInsert(context.Context) error
}
var beforeInsertHookType = reflect.TypeOf((*BeforeInsertHook)(nil)).Elem()
//------------------------------------------------------------------------------
type AfterInsertHook interface {
AfterInsert(context.Context) error
}
var afterInsertHookType = reflect.TypeOf((*AfterInsertHook)(nil)).Elem()
//------------------------------------------------------------------------------
type BeforeUpdateHook interface {
BeforeUpdate(context.Context) error
}
var beforeUpdateHookType = reflect.TypeOf((*BeforeUpdateHook)(nil)).Elem()
//------------------------------------------------------------------------------
type AfterUpdateHook interface {
AfterUpdate(context.Context) error
}
var afterUpdateHookType = reflect.TypeOf((*AfterUpdateHook)(nil)).Elem()
//------------------------------------------------------------------------------
type BeforeDeleteHook interface {
BeforeDelete(context.Context) error
}
var beforeDeleteHookType = reflect.TypeOf((*BeforeDeleteHook)(nil)).Elem()
//------------------------------------------------------------------------------
type AfterDeleteHook interface {
AfterDelete(context.Context) error
}
var afterDeleteHookType = reflect.TypeOf((*AfterDeleteHook)(nil)).Elem()