-
-
Notifications
You must be signed in to change notification settings - Fork 233
/
Copy pathhook.go
43 lines (31 loc) · 975 Bytes
/
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
package schema
import (
"context"
"database/sql"
"reflect"
)
type Model interface {
ScanRows(ctx context.Context, rows *sql.Rows) (int, error)
Value() interface{}
}
type Query interface {
QueryAppender
Operation() string
GetModel() Model
GetTableName() string
}
//------------------------------------------------------------------------------
type BeforeAppendModelHook interface {
BeforeAppendModel(ctx context.Context, query Query) error
}
var beforeAppendModelHookType = reflect.TypeFor[BeforeAppendModelHook]()
//------------------------------------------------------------------------------
type BeforeScanRowHook interface {
BeforeScanRow(context.Context) error
}
var beforeScanRowHookType = reflect.TypeFor[BeforeScanRowHook]()
//------------------------------------------------------------------------------
type AfterScanRowHook interface {
AfterScanRow(context.Context) error
}
var afterScanRowHookType = reflect.TypeFor[AfterScanRowHook]()