summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/hook.go
blob: 624601c9f0be5ae8732887b2298b88557939bb27 (plain)
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
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.TypeOf((*BeforeAppendModelHook)(nil)).Elem()

//------------------------------------------------------------------------------

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 BeforeScanRowHook interface {
	BeforeScanRow(context.Context) error
}

var beforeScanRowHookType = reflect.TypeOf((*BeforeScanRowHook)(nil)).Elem()

//------------------------------------------------------------------------------

type AfterScanRowHook interface {
	AfterScanRow(context.Context) error
}

var afterScanRowHookType = reflect.TypeOf((*AfterScanRowHook)(nil)).Elem()